diff --git a/src/core/thread.c b/src/core/thread.c index 1cbe6cde8..e93cb70f6 100644 --- a/src/core/thread.c +++ b/src/core/thread.c @@ -249,6 +249,12 @@ bool mCoreThreadHasCrashed(struct mCoreThread* threadContext) { 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); diff --git a/src/core/thread.h b/src/core/thread.h index f4bf97bc7..5ef252799 100644 --- a/src/core/thread.h +++ b/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); diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index 861ca1188..785eaf181 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -224,6 +224,7 @@ GameController::GameController(QObject* parent) } } 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 @@ void GameController::cleanGame() { } void GameController::crashGame(const QString& crashMessage) { - cleanGame(); + closeGame(); emit gameCrashed(crashMessage); - emit gameStopped(&m_threadContext); } bool GameController::isPaused() {