Qt: Fix crashing behavior
Jeffrey Pfau jeffrey@endrift.com
Sun, 04 Sep 2016 09:09:24 -0700
3 files changed,
9 insertions(+),
2 deletions(-)
M
src/core/thread.c
→
src/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.h
→
src/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.cpp
→
src/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() {