diff options
-rw-r--r-- | base/main.cpp | 6 | ||||
-rw-r--r-- | common/singleton.h | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/base/main.cpp b/base/main.cpp index a53595ffca..9129fcc7e1 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -330,9 +330,9 @@ extern "C" int scummvm_main(int argc, char *argv[]) { launcherDialog(system); } PluginManager::instance().unloadPluginsExcept(NULL); - PluginManager::instance().destroy(); - ConfMan.destroy(); - g_gui.destroy(); + PluginManager::destroy(); + Common::ConfigManager::destroy(); + GUI::NewGui::destroy(); return 0; } diff --git a/common/singleton.h b/common/singleton.h index 849bf208bb..be9f5d6dba 100644 --- a/common/singleton.h +++ b/common/singleton.h @@ -57,6 +57,11 @@ public: return new T(); } + static void destroyInstance() { + delete _singleton; + _singleton = 0; + } + public: static T& instance() { @@ -71,9 +76,9 @@ public: _singleton = T::makeInstance(); return *_singleton; } - virtual void destroy() { - delete _singleton; - _singleton = 0; + + static void destroy() { + T::destroyInstance(); } protected: Singleton<T>() { } |