From 6d945439eb2f50794351a3eeac566d442256895d Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 16 Feb 2020 00:14:56 +0900 Subject: [PATCH] Qt: Fix possible crash/race when startup fails --- src/duckstation-qt/qthostinterface.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index a887b7a64..4cd025d41 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -227,7 +227,9 @@ void QtHostInterface::doHandleKeyEvent(int key, bool pressed) void QtHostInterface::onDisplayWindowResized(int width, int height) { - m_display_window->onWindowResized(width, height); + // this can be null if it was destroyed and the main thread is late catching up + if (m_display_window) + m_display_window->onWindowResized(width, height); } bool QtHostInterface::AcquireHostDisplay() @@ -258,7 +260,6 @@ void QtHostInterface::ReleaseHostDisplay() { DebugAssert(m_display_window && m_display == m_display_window->getHostDisplayInterface()); m_display = nullptr; - m_display_window->disconnect(this); m_display_window->destroyDeviceContext(); m_display_window = nullptr; emit destroyDisplayWindowRequested();