From f4541b02081533d3783018d612c85004508dadd1 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 1 Mar 2025 16:26:42 +0100 Subject: [PATCH] fix: don't save commands on exit (#6011) --- CHANGELOG.md | 1 + lib/settings | 2 +- src/Application.cpp | 1 - src/controllers/commands/CommandController.cpp | 7 +++++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cf5357f..233941a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Bugfix: Fixed channel point redemptions with messages not showing up if PubSub is disconnected. (#5948) - Bugfix: Fixed the input font not immediately updating when zooming in/out. (#5960) - Bugfix: Fixed color input thinking blue is also red. (#5982) +- Bugfix: Fixed an issue where commands would sometimes reset if Chatterino was improperly shut down. (#6011) - Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947) - Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010) - Dev: Remove unneeded platform specifier for toasts. (#5914) diff --git a/lib/settings b/lib/settings index d1a2e48d..c141a40d 160000 --- a/lib/settings +++ b/lib/settings @@ -1 +1 @@ -Subproject commit d1a2e48df039f47a22cb2972fee6931f5097a258 +Subproject commit c141a40d2d493646cd8f0b1e06251a828dfdfdd2 diff --git a/src/Application.cpp b/src/Application.cpp index 1e3d671d..93442df1 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -598,7 +598,6 @@ eventsub::IController *Application::getEventSub() void Application::save() { - this->commands->save(); this->hotkeys->save(); this->windows->save(); } diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 3fe39864..80a67254 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -299,14 +299,17 @@ CommandController::CommandController(const Paths &paths) // Initialize setting manager for commands.json auto path = combinePath(paths.settingsDirectory, "commands.json"); this->sm_ = std::make_shared(); + this->sm_->saveMethod = + pajlada::Settings::SettingManager::SaveMethod::OnlySaveIfChanged; this->sm_->setPath(qPrintable(path)); this->sm_->setBackupEnabled(true); this->sm_->setBackupSlots(9); // Delayed initialization of the setting storing all commands this->commandsSetting_.reset( - new pajlada::Settings::Setting>("/commands", - this->sm_)); + new pajlada::Settings::Setting>( + "/commands", pajlada::Settings::SettingOption::CompareBeforeSet, + this->sm_)); // Update the setting when the vector of commands has been updated (most // likely from the settings dialog)