Qt: Fix possible race when showing confirm dialog

This commit is contained in:
Stenzek 2023-11-24 14:26:55 +10:00
parent 3e27c399f4
commit a705884342
No known key found for this signature in database

View File

@ -367,7 +367,7 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main, bool
{ {
// See lameland comment above. // See lameland comment above.
if (use_main_window_pos && !s_use_central_widget) if (use_main_window_pos && !s_use_central_widget)
container->move(pos()); container->setGeometry(geometry());
else else
restoreDisplayWindowGeometryFromConfig(); restoreDisplayWindowGeometryFromConfig();
container->showNormal(); container->showNormal();
@ -2911,8 +2911,14 @@ MainWindow::SystemLock MainWindow::pauseAndLockSystem()
if (was_fullscreen) if (was_fullscreen)
{ {
g_emu_thread->setFullscreen(false, false); g_emu_thread->setFullscreen(false, false);
while (s_system_valid && g_emu_thread->isFullscreen())
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 1); // Container could change... thanks Wayland.
QWidget* container;
while (s_system_valid &&
(g_emu_thread->isFullscreen() || !(container = getDisplayContainer()) || container->isFullScreen()))
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
} }
if (!was_paused) if (!was_paused)