Fix Windows Portable Crash (#5371)

This commit is contained in:
Zach H 2024-12-28 22:02:52 -05:00 committed by GitHub
parent 716bc00533
commit 24a0dac420
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -118,6 +118,9 @@ GeneralSettingsPage::GeneralSettingsPage()
QPushButton *tokenDatabasePathButton = new QPushButton("...");
connect(tokenDatabasePathButton, SIGNAL(clicked()), this, SLOT(tokenDatabasePathButtonClicked()));
// Required init here to avoid crashing on Portable builds
resetAllPathsButton = new QPushButton;
bool isPortable = settings.getIsPortableBuild();
if (isPortable) {
deckPathEdit->setEnabled(false);
@ -134,7 +137,6 @@ GeneralSettingsPage::GeneralSettingsPage()
customCardDatabasePathButton->setVisible(false);
tokenDatabasePathButton->setVisible(false);
} else {
resetAllPathsButton = new QPushButton;
connect(resetAllPathsButton, SIGNAL(clicked()), this, SLOT(resetAllPathsClicked()));
allPathsResetLabel = new QLabel(tr("All paths have been reset"));
allPathsResetLabel->setVisible(false);
@ -302,9 +304,7 @@ void GeneralSettingsPage::retranslateUi()
updateNotificationCheckBox.setText(tr("Notify if a feature supported by the server is missing in my client"));
newVersionOracleCheckBox.setText(tr("Automatically run Oracle when running a new version of Cockatrice"));
showTipsOnStartup.setText(tr("Show tips on startup"));
if (resetAllPathsButton) {
resetAllPathsButton->setText(tr("Reset all paths"));
}
resetAllPathsButton->setText(tr("Reset all paths"));
const auto &settings = SettingsCache::instance();