Skip to content

Commit

Permalink
fix: Settings not being saved correctly anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Jan 3, 2025
1 parent d8fb3f5 commit 525ab8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
10 changes: 1 addition & 9 deletions lib/libimhex/source/api/content_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions plugins/builtin/source/content/settings_entries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ namespace hex::plugin::builtin {
for (const auto &entry : subcategory.entries) {
if (auto keybindingWidget = dynamic_cast<KeybindingWidget*>(entry.widget.get())) {
keybindingWidget->reset();
ContentRegistry::Settings::write<nlohmann::json>(category.unlocalizedName, entry.unlocalizedName, keybindingWidget->store());
}
}
}
Expand Down

0 comments on commit 525ab8d

Please sign in to comment.