From 525ab8d945882c8d0f03761929eadaba64f8ea34 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 3 Jan 2025 14:07:09 +0100 Subject: [PATCH] fix: Settings not being saved correctly anymore --- lib/libimhex/source/api/content_registry.cpp | 10 +--------- plugins/builtin/source/content/settings_entries.cpp | 1 + 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/libimhex/source/api/content_registry.cpp b/lib/libimhex/source/api/content_registry.cpp index 1fbf3a0b7..f31090788 100644 --- a/lib/libimhex/source/api/content_registry.cpp +++ b/lib/libimhex/source/api/content_registry.cpp @@ -154,18 +154,10 @@ namespace hex { if (!s_settings.isValid()) return; - for (const auto &category : getSettings()) { - for (const auto &subCategory : category.subCategories) { - for (const auto &entry : subCategory.entries) { - (*s_settings)[category.unlocalizedName][entry.unlocalizedName] = entry.widget->store(); - } - } - } - const auto &settingsData = *s_settings; // During a crash settings can be empty, causing them to be overwritten. - if (settingsData.empty()) { + if (s_settings->empty()) { return; } diff --git a/plugins/builtin/source/content/settings_entries.cpp b/plugins/builtin/source/content/settings_entries.cpp index 22b423720..9028d3f8c 100644 --- a/plugins/builtin/source/content/settings_entries.cpp +++ b/plugins/builtin/source/content/settings_entries.cpp @@ -1002,6 +1002,7 @@ namespace hex::plugin::builtin { for (const auto &entry : subcategory.entries) { if (auto keybindingWidget = dynamic_cast(entry.widget.get())) { keybindingWidget->reset(); + ContentRegistry::Settings::write(category.unlocalizedName, entry.unlocalizedName, keybindingWidget->store()); } } }