diff --git a/CHANGES b/CHANGES index 6dcfef142..ac38cc9d2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 0.5.0: (Future) Bugfixes: - VFS: Fix reading 7z archives without rewinding first + - Qt: Fix sending gameStopped twice Misc: - GBA: Slightly optimize GBAProcessEvents diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index c409d8103..b81b7356c 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -11,6 +11,7 @@ #include "MultiplayerController.h" #include "VFileDevice.h" +#include #include #include @@ -419,6 +420,8 @@ void GameController::closeGame() { if (!m_gameOpen) { return; } + m_gameOpen = false; + m_rewindTimer.stop(); if (GBAThreadIsPaused(&m_threadContext)) { GBAThreadUnpause(&m_threadContext); @@ -426,6 +429,8 @@ void GameController::closeGame() { m_audioProcessor->pause(); GBAThreadEnd(&m_threadContext); GBAThreadJoin(&m_threadContext); + // Make sure the event queue clears out before the thread is reused + QCoreApplication::processEvents(); if (m_threadContext.fname) { free(const_cast(m_threadContext.fname)); m_threadContext.fname = nullptr;