all repos — mgba @ 51e214ce5ad644d88ffbe80a6b6c51b513bc7efb

mGBA Game Boy Advance Emulator

Qt: Fix crashing behavior
Jeffrey Pfau jeffrey@endrift.com
Sun, 04 Sep 2016 09:09:24 -0700
commit

51e214ce5ad644d88ffbe80a6b6c51b513bc7efb

parent

a20061e925f00eb6bcfd1387a498d0db51bd6f23

3 files changed, 9 insertions(+), 2 deletions(-)

jump to
M src/core/thread.csrc/core/thread.c

@@ -249,6 +249,12 @@ MutexUnlock(&threadContext->stateMutex);

return hasExited; } +void mCoreThreadMarkCrashed(struct mCoreThread* threadContext) { + MutexLock(&threadContext->stateMutex); + threadContext->state = THREAD_CRASHED; + MutexUnlock(&threadContext->stateMutex); +} + void mCoreThreadEnd(struct mCoreThread* threadContext) { MutexLock(&threadContext->stateMutex); _waitOnInterrupt(threadContext);
M src/core/thread.hsrc/core/thread.h

@@ -72,6 +72,7 @@ bool mCoreThreadStart(struct mCoreThread* threadContext);

bool mCoreThreadHasStarted(struct mCoreThread* threadContext); bool mCoreThreadHasExited(struct mCoreThread* threadContext); bool mCoreThreadHasCrashed(struct mCoreThread* threadContext); +void mCoreThreadMarkCrashed(struct mCoreThread* threadContext); void mCoreThreadEnd(struct mCoreThread* threadContext); void mCoreThreadReset(struct mCoreThread* threadContext); void mCoreThreadJoin(struct mCoreThread* threadContext);
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -224,6 +224,7 @@ }

} } if (level == mLOG_FATAL) { + mCoreThreadMarkCrashed(controller->thread()); QMetaObject::invokeMethod(controller, "crashGame", Q_ARG(const QString&, QString().vsprintf(format, args))); } else if (!(controller->m_logLevels & level)) { return;

@@ -556,9 +557,8 @@ m_gameOpen = false;

} void GameController::crashGame(const QString& crashMessage) { - cleanGame(); + closeGame(); emit gameCrashed(crashMessage); - emit gameStopped(&m_threadContext); } bool GameController::isPaused() {