From e82218f8230f29898c50c267a9011487b95d575d Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 26 Jul 2025 22:32:55 +1000 Subject: [PATCH] Qt: Fix changing language while game running --- src/duckstation-qt/mainwindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 66c0e4abe..babe93210 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -809,8 +809,8 @@ void MainWindow::recreate() // We need to close input sources, because e.g. DInput uses our window handle. g_emu_thread->closeInputSources(); - close(); g_main_window = nullptr; + close(); MainWindow* new_main_window = new MainWindow(); DebugAssert(g_main_window == new_main_window); @@ -2665,12 +2665,13 @@ void MainWindow::showEvent(QShowEvent* event) void MainWindow::closeEvent(QCloseEvent* event) { // If there's no VM, we can just exit as normal. - if (!QtHost::IsSystemValidOrStarting()) + // When recreating, g_main_window will be null at this point. + if (!QtHost::IsSystemValidOrStarting() || !g_main_window) { QtUtils::SaveWindowGeometry("MainWindow", this); // surfaceless for language change - if (s_fullscreen_ui_started && !g_emu_thread->isSurfaceless()) + if (s_fullscreen_ui_started && g_main_window) g_emu_thread->stopFullscreenUI(); destroySubWindows();