diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 6ea9f9c0f..d63c20668 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -270,7 +270,7 @@ MainWindow::MainWindow(QWidget *parent) : } void MainWindow::closeEvent(QCloseEvent *event) { - if (confirm_exit) + if (confirm_exit && cpu_thread_run) { QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", "Are you sure you want to exit 86Box?", QMessageBox::Yes | QMessageBox::No, this); QCheckBox *chkbox = new QCheckBox("Do not ask me again"); diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 8d30ab5df..9665c3a1b 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -16,12 +16,15 @@ #include #include +#include "qt_mainwindow.hpp" + #ifdef Q_OS_UNIX #include #endif // static QByteArray buf; extern QElapsedTimer elapsed_timer; +extern MainWindow* main_window; QElapsedTimer elapsed_timer; static std::atomic_int blitmx_contention = 0; @@ -355,6 +358,7 @@ plat_power_off(void) cycles -= 99999999; cpu_thread_run = 0; + main_window->close(); } void set_language(uint32_t id) {