diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 9a5d1eff1..75510a613 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -616,6 +616,7 @@ int main(int argc, char* argv[]) CollectionSystemsManager::deinit(); SystemData::deleteSystems(); NavigationSounds::getInstance()->deinit(); + Settings::deinit(); // Call this ONLY when linking with FreeImage as a static library. #if defined(FREEIMAGE_LIB) diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 963b80532..512eafc2a 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -72,10 +72,19 @@ Settings* Settings::getInstance() return sInstance; } +void Settings::deinit() +{ + if (sInstance) { + delete sInstance; + sInstance = nullptr; + } +} + void Settings::setDefaults() { mBoolMap.clear(); mIntMap.clear(); + mStringMap.clear(); // All settings are in pairs of default values and current values. // As such, in this function we set these pairs identically. diff --git a/es-core/src/Settings.h b/es-core/src/Settings.h index e657126d6..822fc27ce 100644 --- a/es-core/src/Settings.h +++ b/es-core/src/Settings.h @@ -18,6 +18,7 @@ class Settings { public: static Settings* getInstance(); + static void deinit(); void loadFile(); void saveFile();