Qt: Fix main window stuck open after update

This commit is contained in:
Stenzek 2024-03-23 02:26:50 +10:00
parent d96062b690
commit 4d5c8cb134
No known key found for this signature in database
2 changed files with 21 additions and 3 deletions

View file

@ -588,8 +588,7 @@ void MainWindow::onSystemDestroyed()
// If we're closing or in batch mode, quit the whole application now. // If we're closing or in batch mode, quit the whole application now.
if (m_is_closing || QtHost::InBatchMode()) if (m_is_closing || QtHost::InBatchMode())
{ {
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 1); quit();
QCoreApplication::quit();
return; return;
} }
@ -701,6 +700,22 @@ std::string MainWindow::getDeviceDiscPath(const QString& title)
return ret; return ret;
} }
void MainWindow::quit()
{
// Make sure VM is gone. It really should be if we're here.
if (s_system_valid)
{
g_emu_thread->shutdownSystem(false);
while (s_system_valid)
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 1);
}
// Ensure subwindows are removed before quitting. That way the log window cancelling
// the close event won't cancel the quit process.
destroySubWindows();
QGuiApplication::quit();
}
void MainWindow::recreate() void MainWindow::recreate()
{ {
const bool was_display_created = m_display_created; const bool was_display_created = m_display_created;
@ -2786,7 +2801,7 @@ void MainWindow::requestExit(bool allow_confirm /* = true */)
if (s_system_valid) if (s_system_valid)
m_is_closing = true; m_is_closing = true;
else else
QGuiApplication::quit(); quit();
} }
void MainWindow::checkForSettingChanges() void MainWindow::checkForSettingChanges()

View file

@ -87,6 +87,9 @@ public:
/// Locks the system by pausing it, while a popup dialog is displayed. /// Locks the system by pausing it, while a popup dialog is displayed.
SystemLock pauseAndLockSystem(); SystemLock pauseAndLockSystem();
/// Force quits the application.
void quit();
/// Accessors for the status bar widgets, updated by the emulation thread. /// Accessors for the status bar widgets, updated by the emulation thread.
ALWAYS_INLINE QLabel* getStatusRendererWidget() const { return m_status_renderer_widget; } ALWAYS_INLINE QLabel* getStatusRendererWidget() const { return m_status_renderer_widget; }
ALWAYS_INLINE QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; } ALWAYS_INLINE QLabel* getStatusResolutionWidget() const { return m_status_resolution_widget; }