diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-10-08 23:24:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-08 23:24:53 -0400 |
| commit | c01e80a651f5e25441330ad20253bb47ad0f516c (patch) | |
| tree | c801c21b793f2fd4d9c141b7c0efe9836912a99a /src/main.cpp | |
| parent | 94b40b328b7e455ad4799b98c2b00cd5d96f86f3 (diff) | |
| parent | 3d97b0efd04326c0252411fc6639c4c6df2f2160 (diff) | |
Merge pull request #858 from isanae/proper-exit
Proper exit procedure
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index a6918d99..f08ba066 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -563,10 +563,12 @@ int runApplication(MOApplication &application, SingleInstance &instance, if (game == nullptr) { InstanceManager &instance = InstanceManager::instance(); QString instanceName = instance.currentInstance(); + if (instanceName.compare("Portable", Qt::CaseInsensitive) != 0) { instance.clearCurrentInstance(); - return INT_MAX; + return RestartExitCode; } + return 1; } @@ -710,6 +712,8 @@ int runApplication(MOApplication &application, SingleInstance &instance, splash.finish(&mainWindow); res = application.exec(); + mainWindow.onBeforeClose(); + mainWindow.close(); NexusInterface::instance(&pluginContainer) ->getAccessManager()->setTopLevelWidget(nullptr); @@ -867,6 +871,7 @@ int main(int argc, char *argv[]) do { LogModel::instance().clear(); + ResetExitFlag(); // make sure the log file isn't locked in case MO was restarted and // the previous instance gets deleted @@ -904,10 +909,11 @@ int main(int argc, char *argv[]) splash = ":/MO/gui/splash"; } - int result = runApplication(application, instance, splash); - if (result != INT_MAX) { + const int result = runApplication(application, instance, splash); + if (result != RestartExitCode) { return result; } + argc = 1; moshortcut = MOShortcut(""); } while (true); |
