From cadceecdab62c255cbd321afd48cec91fc340668 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 20 Dec 2020 21:00:17 -0800 Subject: [PATCH] Qt: Fix loading a new game crashing on Wayland (fixes #1992) --- CHANGES | 1 + src/platform/qt/Window.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 498c34bd4..3dc9719de 100644 --- a/CHANGES +++ b/CHANGES @@ -82,6 +82,7 @@ Other fixes: - Qt: Fix crash when editing shortcuts with none selected (fixes mgba.io/i/1964) - Qt: Fix crashing when no OpenGL context can be obtained - Qt: Fix issues with I/O viewer not properly synchronizing state + - Qt: Fix loading a new game crashing on Wayland (fixes mgba.io/i/1992) - SM83: Simplify register pair access on big endian - SM83: Disassemble STOP as one byte - Wii: Fix crash on unloading irregularly sized GBA ROMs diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 19ff05c27..77294d05b 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -808,15 +808,6 @@ void Window::gameStopped() { action->setEnabled(false); } setWindowFilePath(QString()); - detachWidget(m_display.get()); - setLogo(); - if (m_display) { -#ifdef M_CORE_GB - m_display->setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS); -#elif defined(M_CORE_GBA) - m_display->setMinimumSize(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS); -#endif - } m_actions.clearMenu("videoLayers"); m_actions.clearMenu("audioChannels"); @@ -829,6 +820,15 @@ void Window::gameStopped() { m_audioProcessor.reset(); } m_display->stopDrawing(); + detachWidget(m_display.get()); + setLogo(); + if (m_display) { +#ifdef M_CORE_GB + m_display->setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS); +#elif defined(M_CORE_GBA) + m_display->setMinimumSize(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS); +#endif + } m_controller.reset(); updateTitle();