all repos — mgba @ 5406130432f1a487a9768ac4fe5eb07dec4b4fed

mGBA Game Boy Advance Emulator

Qt: Clean up games in cleanCallback
Jeffrey Pfau jeffrey@endrift.com
Thu, 27 Oct 2016 10:19:10 -0700
commit

5406130432f1a487a9768ac4fe5eb07dec4b4fed

parent

ecba499b957f687efc597c6d86ebb37019a9982c

1 files changed, 9 insertions(+), 7 deletions(-)

jump to
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -169,6 +169,15 @@ };

m_threadContext.cleanCallback = [](mCoreThread* context) { GameController* controller = static_cast<GameController*>(context->userData); + + if (controller->m_multiplayer) { + controller->m_multiplayer->detachGame(controller); + } + controller->m_patch = QString(); + controller->clearOverride(); + + QMetaObject::invokeMethod(controller->m_audioProcessor, "pause", Qt::BlockingQueuedConnection); + QMetaObject::invokeMethod(controller, "gameStopped", Q_ARG(mCoreThread*, context)); QMetaObject::invokeMethod(controller, "cleanGame"); };

@@ -589,17 +598,10 @@ void GameController::closeGame() {

if (!m_gameOpen) { return; } - if (m_multiplayer) { - m_multiplayer->detachGame(this); - } if (mCoreThreadIsPaused(&m_threadContext)) { mCoreThreadUnpause(&m_threadContext); } - m_patch = QString(); - clearOverride(); - - QMetaObject::invokeMethod(m_audioProcessor, "pause", Qt::BlockingQueuedConnection); mCoreThreadEnd(&m_threadContext); }