mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
fix: Crash when restarting ImHex more than once
This commit is contained in:
@@ -106,13 +106,15 @@ namespace hex {
|
||||
if (!loaded)
|
||||
store();
|
||||
|
||||
for (const auto &[category, rest] : *impl::s_onChangeCallbacks) {
|
||||
for (const auto &[name, callbacks] : rest) {
|
||||
for (const auto &[id, callback] : callbacks) {
|
||||
callback(getSetting(category, name, {}));
|
||||
TaskManager::doLater([] {
|
||||
for (const auto &[category, rest] : *impl::s_onChangeCallbacks) {
|
||||
for (const auto &[name, callbacks] : rest) {
|
||||
for (const auto &[id, callback] : callbacks) {
|
||||
callback(getSetting(category, name, {}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void store() {
|
||||
|
||||
@@ -471,6 +471,16 @@ namespace hex {
|
||||
return s_windowResizable;
|
||||
}
|
||||
|
||||
static std::vector<AutoResetBase*> s_autoResetObjects;
|
||||
void addAutoResetObject(AutoResetBase *object) {
|
||||
s_autoResetObjects.emplace_back(object);
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
for (const auto &object : s_autoResetObjects)
|
||||
object->reset();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user