aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-01-21 02:30:50 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-21 02:32:01 +0100
commitcac7734bd0439abb40cf5bdf903335e57a0f017c (patch)
tree11a172c69bdaf1b6313cb22dbd326a0618553dc7
parentb7519f2a9f0f1d7a166ac99764e5a8431636924a (diff)
downloadusdx-cac7734bd0439abb40cf5bdf903335e57a0f017c.tar.gz
usdx-cac7734bd0439abb40cf5bdf903335e57a0f017c.tar.xz
usdx-cac7734bd0439abb40cf5bdf903335e57a0f017c.zip
menu/application: add free to allow multiple runs
free() is used to reset the instance of this singleton, so that it gets recreated on the next access. This allows multiple creation/deletion cycles (for example in the tests).
-rw-r--r--src/main.cpp2
-rw-r--r--src/menu/application.cpp6
-rw-r--r--src/menu/application.hpp2
3 files changed, 9 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a7f7e2b6..9e1ba84b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,7 +28,7 @@
int main (int argc, char** argv)
{
usdx::Application::get_instance()->run();
- delete usdx::Application::get_instance();
+ usdx::Application::free();
return EXIT_SUCCESS;
}
diff --git a/src/menu/application.cpp b/src/menu/application.cpp
index f4802220..f9be797f 100644
--- a/src/menu/application.cpp
+++ b/src/menu/application.cpp
@@ -81,6 +81,12 @@ namespace usdx
return instance;
}
+ void Application::free(void)
+ {
+ delete instance;
+ instance = NULL;
+ }
+
Config* Application::get_config(void)
{
return get_instance()->config;
diff --git a/src/menu/application.hpp b/src/menu/application.hpp
index 78b4e01d..c6eea5c8 100644
--- a/src/menu/application.hpp
+++ b/src/menu/application.hpp
@@ -67,6 +67,8 @@ namespace usdx
virtual ~Application();
static Application* get_instance(void);
+ static void free(void);
+
static Config* get_config(void);
static bool is_gl_thread(void);