aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-26 10:21:53 +0000
committerJohannes Schickel2008-04-26 10:21:53 +0000
commitbba003e53a13b16a2584bf4aec7bc79c949924ae (patch)
tree6188c9f451bbf9c82aa68e933e3c5b0c1dcf648f
parent61101b6dcef33d99f53705e40c9214ccd63fe847 (diff)
downloadscummvm-rg350-bba003e53a13b16a2584bf4aec7bc79c949924ae.tar.gz
scummvm-rg350-bba003e53a13b16a2584bf4aec7bc79c949924ae.tar.bz2
scummvm-rg350-bba003e53a13b16a2584bf4aec7bc79c949924ae.zip
Fixed segfault when trying to start invalid gameid from command line.
svn-id: r31731
-rw-r--r--base/main.cpp6
-rw-r--r--common/singleton.h11
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>() { }