Application::Application():
exit_code(0)
-{ }
-
-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(app_)
+ throw logic_error("instance already exists");
+}
+int Application::run(int argc, char **argv, void *data, void (*created_callback)(void *))
+{
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;
}
return 1;
}
+ if(created_callback)
+ created_callback(data);
+
int result = app_->main();
Application *a = app_;
app_ = 0;
}
delete app_;
+ app_ = 0;
return 124;
}