More fixes around Python exit codes

This commit is contained in:
Ian Rees
2016-03-27 13:01:04 +13:00
parent c4bd392d85
commit 7f42b2b8fb
5 changed files with 23 additions and 20 deletions

View File

@@ -1553,8 +1553,7 @@ void Application::runApplication(void)
Base::Console().Log("Init: Creating Gui::Application and QApplication\n");
// if application not yet created by the splasher
int argc = App::Application::GetARGC();
int systemExit = 1000;
GUISingleApplication mainApp(argc, App::Application::GetARGV(), systemExit);
GUISingleApplication mainApp(argc, App::Application::GetARGV());
// check if a single or multiple instances can run
it = cfg.find("SingleInstance");
@@ -1786,9 +1785,11 @@ void Application::runApplication(void)
boost::interprocess::file_lock flock(s.str().c_str());
flock.lock();
int ret = mainApp.exec();
if (ret == systemExit)
throw Base::SystemExitException();
mainApp.exec();
// Qt can't handle exceptions thrown from event handlers, so we need
// to manually rethrow SystemExitExceptions.
if(mainApp.caughtException.get())
throw Base::SystemExitException(*mainApp.caughtException.get());
// close the lock file, in case of a crash we can see the existing lock file
// on the next restart and try to repair the documents, if needed.