From 4404b06d2afdaf37d49b44a06e4e2cf22c427b7a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 5 Apr 2023 18:15:38 +1000 Subject: [PATCH] Qt: Fix lockup when cancelling shutdown and fullscreen --- pcsx2-qt/MainWindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index 7c6deb56ca..4440c7ce8c 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -3000,8 +3000,16 @@ MainWindow::VMLock::~VMLock() { if (m_was_fullscreen) g_emu_thread->setSurfaceless(false); + if (!m_was_paused) g_emu_thread->setVMPaused(false); + + if (m_was_fullscreen) + { + // Wait until we get the display widget back, so we're not the last window left and closing. + while (QtHost::IsVMValid() && !g_main_window->m_display_widget) + QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 1); + } } void MainWindow::VMLock::cancelResume()