Application::run can now be called multiple times, but not recursively.
Application::Application():
exit_code(0)
-{ }
+{
+ if(app_)
+ throw logic_error("instance already exists");
+}
int Application::run(int argc, char **argv, void *data)
{
- static bool called = false;
- if(called)
- {
- IO::cerr.write("Trying to call Application::run_app twice!\n");
- return 125;
- }
- called = true;
-
if(!starter_)
{
- IO::cerr.write("Trying to run with no RegisteredApplication class!\n");
+ IO::cerr.write("Application::run called with no RegisteredApplication class!\n");
return 126;
}
}
delete app_;
+ app_ = 0;
return 124;
}