Qt: Fix application exiting on fullscreen+lang change

This commit is contained in:
Stenzek 2025-05-23 15:21:44 +10:00
parent 66934cc5b8
commit cdadda85b5
No known key found for this signature in database

View File

@ -737,8 +737,13 @@ void MainWindow::recreate()
destroySubWindows();
const bool was_display_created = m_display_created;
const bool was_fullscreen = (was_display_created && g_emu_thread->isFullscreen());
if (was_display_created)
{
// Ensure the main window is visible, otherwise last-window-closed terminates the application.
if (!isVisible())
show();
g_emu_thread->setSurfaceless(true);
QtUtils::ProcessEventsWithSleep(QEventLoop::ExcludeUserInputEvents,
[this]() { return (m_display_widget || !g_emu_thread->isSurfaceless()); });
@ -770,6 +775,8 @@ void MainWindow::recreate()
if (was_display_created)
{
g_emu_thread->setSurfaceless(false);
if (was_fullscreen)
g_emu_thread->setFullscreen(true, true);
g_main_window->updateEmulationActions(false, s_system_valid, s_achievements_hardcore_mode);
g_main_window->onFullscreenUIStartedOrStopped(s_fullscreen_ui_started);
}