Qt: Fix changing language while game running

This commit is contained in:
Stenzek 2025-07-26 22:32:55 +10:00
parent 47fe487c2e
commit e82218f823
No known key found for this signature in database

View File

@ -809,8 +809,8 @@ void MainWindow::recreate()
// We need to close input sources, because e.g. DInput uses our window handle. // We need to close input sources, because e.g. DInput uses our window handle.
g_emu_thread->closeInputSources(); g_emu_thread->closeInputSources();
close();
g_main_window = nullptr; g_main_window = nullptr;
close();
MainWindow* new_main_window = new MainWindow(); MainWindow* new_main_window = new MainWindow();
DebugAssert(g_main_window == new_main_window); DebugAssert(g_main_window == new_main_window);
@ -2665,12 +2665,13 @@ void MainWindow::showEvent(QShowEvent* event)
void MainWindow::closeEvent(QCloseEvent* event) void MainWindow::closeEvent(QCloseEvent* event)
{ {
// If there's no VM, we can just exit as normal. // 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); QtUtils::SaveWindowGeometry("MainWindow", this);
// surfaceless for language change // 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(); g_emu_thread->stopFullscreenUI();
destroySubWindows(); destroySubWindows();