summaryrefslogtreecommitdiffstats
path: root/application/MainWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'application/MainWindow.cpp')
-rw-r--r--application/MainWindow.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp
index bf9da0dc..70a0fbf1 100644
--- a/application/MainWindow.cpp
+++ b/application/MainWindow.cpp
@@ -1356,12 +1356,27 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered()
void MainWindow::closeEvent(QCloseEvent *event)
{
- // Save the window state and geometry.
+ if(MMC->numRunningInstances())
+ {
+ auto resBtn = QMessageBox::question(
+ this,
+ tr("Do you want to close MultiMC?"),
+ tr("<p>You still have instances running.</p><p>Closing MultiMC will result in inaccurate time tracking and no Minecraft crash handling.</p><p>Are you sure?</p>"),
+ QMessageBox::No | QMessageBox::Yes,
+ QMessageBox::Yes
+ );
+ if (resBtn != QMessageBox::Yes)
+ {
+ event->ignore();
+ return;
+ }
+ }
+ // no running instances or user said yes.
+ event->accept();
+ // Save the window state and geometry.
MMC->settings()->set("MainWindowState", saveState().toBase64());
MMC->settings()->set("MainWindowGeometry", saveGeometry().toBase64());
-
- QMainWindow::closeEvent(event);
QApplication::exit();
}