From 24a0dac4202843d90c19f4d16b1906631c268579 Mon Sep 17 00:00:00 2001 From: Zach H Date: Sat, 28 Dec 2024 22:02:52 -0500 Subject: [PATCH] Fix Windows Portable Crash (#5371) --- cockatrice/src/dialogs/dlg_settings.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/dialogs/dlg_settings.cpp b/cockatrice/src/dialogs/dlg_settings.cpp index ded46e489..9eae7a6b4 100644 --- a/cockatrice/src/dialogs/dlg_settings.cpp +++ b/cockatrice/src/dialogs/dlg_settings.cpp @@ -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();