summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-12-15 22:35:02 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2019-12-15 22:35:02 -0500
commit05231eab45f86e3d0d342c429e35c8f7c813ea42 (patch)
treec61701573f691aae40fc6b801060ea120eb4d617 /src/mainwindow.cpp
parentf3c5cebb6e9262625105d4339a54a810d7816811 (diff)
temporary fix to keep MO locked for all processes when closing
save main window settings in closeEvent()
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d1578d85..284c33e3 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1306,6 +1306,21 @@ void MainWindow::onBeforeClose()
void MainWindow::closeEvent(QCloseEvent* event)
{
+ if (isVisible()) {
+ // this is messy
+ //
+ // the main problem this is solving is when closing MO, then getting the
+ // lock overlay because processes are still running, then pressing the X
+ // again
+ //
+ // in this case, closeEvent() is _not_ called for the second event and the
+ // window is immediately hidden
+ //
+ // this always saves the settings here; in the event where a lock overlay
+ // is then shown, it might save settings multiple times, but it's harmless
+ onBeforeClose();
+ }
+
// this happens for two reasons:
// 1) the user requested to close the window, such as clicking the X
// 2) close() is called in runApplication() after application.exec()
@@ -1324,6 +1339,13 @@ void MainWindow::closeEvent(QCloseEvent* event)
return;
}
+ if (UILocker::instance().locked()) {
+ // don't bother asking the user to confirm if the ui is already locked
+ event->ignore();
+ ExitModOrganizer(Exit::Force);
+ return;
+ }
+
if (ModOrganizerExiting()) {
// ignore repeated attempts
event->ignore();