From d25ef67d6fc62eb96e0df8241d35a35e8ef38902 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 4 Mar 2026 21:53:18 +0100 Subject: [PATCH] DolphinQt: Save when closing settings window If Dolphin crashes, changes that have been made to settings are often lost. This has been a minor annoyance for me when developing, but it has become a much bigger issue recently due to the problem where Dolphin freezes on shutdown for ROG Ally users. Instead of saving the config when certain arbitrary settings are changed, let's save the config when the user closes the settings window. --- Source/Core/DolphinQt/Config/SettingsWindow.cpp | 5 +++++ Source/Core/DolphinQt/Config/SettingsWindow.h | 2 ++ Source/Core/DolphinQt/Settings/GeneralPane.cpp | 5 ----- Source/Core/DolphinQt/Settings/WiiPane.cpp | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinQt/Config/SettingsWindow.cpp b/Source/Core/DolphinQt/Config/SettingsWindow.cpp index e80b1fa7ff..283cd3786e 100644 --- a/Source/Core/DolphinQt/Config/SettingsWindow.cpp +++ b/Source/Core/DolphinQt/Config/SettingsWindow.cpp @@ -210,3 +210,8 @@ void SettingsWindow::SelectPane(SettingsWindowPaneIndex index) { ActivatePane(std::to_underlying(index)); } + +void SettingsWindow::closeEvent(QCloseEvent*) +{ + Config::Save(); +} diff --git a/Source/Core/DolphinQt/Config/SettingsWindow.h b/Source/Core/DolphinQt/Config/SettingsWindow.h index 3874c75ae0..c27d6e919d 100644 --- a/Source/Core/DolphinQt/Config/SettingsWindow.h +++ b/Source/Core/DolphinQt/Config/SettingsWindow.h @@ -60,4 +60,6 @@ public: explicit SettingsWindow(MainWindow* parent); void SelectPane(SettingsWindowPaneIndex); + + void closeEvent(QCloseEvent* event) override; }; diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.cpp b/Source/Core/DolphinQt/Settings/GeneralPane.cpp index 802292f688..7561aaa939 100644 --- a/Source/Core/DolphinQt/Settings/GeneralPane.cpp +++ b/Source/Core/DolphinQt/Settings/GeneralPane.cpp @@ -16,7 +16,6 @@ #include "Core/AchievementManager.h" #include "Core/Config/MainSettings.h" #include "Core/Config/UISettings.h" -#include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/DolphinAnalytics.h" #include "Core/System.h" @@ -117,7 +116,6 @@ void GeneralPane::ConnectLayout() connect(m_combobox_speedlimit, &QComboBox::currentIndexChanged, [this] { Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED, m_combobox_speedlimit->currentIndex() * 0.1f); - Config::Save(); }); connect(m_combobox_fallback_region, &QComboBox::currentIndexChanged, this, @@ -339,7 +337,6 @@ void GeneralPane::OnSaveConfig() { Config::ConfigChangeCallbackGuard config_guard; - auto& settings = SConfig::GetInstance(); if (AutoUpdateChecker::SystemSupportsAutoUpdates()) { Settings::Instance().SetAutoUpdateTrack( @@ -356,8 +353,6 @@ void GeneralPane::OnSaveConfig() #endif Settings::Instance().SetFallbackRegion( UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex())); - - settings.SaveSettings(); } #if defined(USE_ANALYTICS) && USE_ANALYTICS diff --git a/Source/Core/DolphinQt/Settings/WiiPane.cpp b/Source/Core/DolphinQt/Settings/WiiPane.cpp index 19d54ca50c..bab5b9b540 100644 --- a/Source/Core/DolphinQt/Settings/WiiPane.cpp +++ b/Source/Core/DolphinQt/Settings/WiiPane.cpp @@ -369,7 +369,6 @@ void WiiPane::OnUSBWhitelistAddButton() } whitelist.emplace(*usb_device); Config::SetUSBDeviceWhitelist(whitelist); - Config::Save(); PopulateUSBPassthroughListWidget(); }