mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix crashing behavior
This commit is contained in:
parent
a20061e925
commit
51e214ce5a
|
@ -249,6 +249,12 @@ bool mCoreThreadHasCrashed(struct mCoreThread* threadContext) {
|
||||||
return hasExited;
|
return hasExited;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mCoreThreadMarkCrashed(struct mCoreThread* threadContext) {
|
||||||
|
MutexLock(&threadContext->stateMutex);
|
||||||
|
threadContext->state = THREAD_CRASHED;
|
||||||
|
MutexUnlock(&threadContext->stateMutex);
|
||||||
|
}
|
||||||
|
|
||||||
void mCoreThreadEnd(struct mCoreThread* threadContext) {
|
void mCoreThreadEnd(struct mCoreThread* threadContext) {
|
||||||
MutexLock(&threadContext->stateMutex);
|
MutexLock(&threadContext->stateMutex);
|
||||||
_waitOnInterrupt(threadContext);
|
_waitOnInterrupt(threadContext);
|
||||||
|
|
|
@ -72,6 +72,7 @@ bool mCoreThreadStart(struct mCoreThread* threadContext);
|
||||||
bool mCoreThreadHasStarted(struct mCoreThread* threadContext);
|
bool mCoreThreadHasStarted(struct mCoreThread* threadContext);
|
||||||
bool mCoreThreadHasExited(struct mCoreThread* threadContext);
|
bool mCoreThreadHasExited(struct mCoreThread* threadContext);
|
||||||
bool mCoreThreadHasCrashed(struct mCoreThread* threadContext);
|
bool mCoreThreadHasCrashed(struct mCoreThread* threadContext);
|
||||||
|
void mCoreThreadMarkCrashed(struct mCoreThread* threadContext);
|
||||||
void mCoreThreadEnd(struct mCoreThread* threadContext);
|
void mCoreThreadEnd(struct mCoreThread* threadContext);
|
||||||
void mCoreThreadReset(struct mCoreThread* threadContext);
|
void mCoreThreadReset(struct mCoreThread* threadContext);
|
||||||
void mCoreThreadJoin(struct mCoreThread* threadContext);
|
void mCoreThreadJoin(struct mCoreThread* threadContext);
|
||||||
|
|
|
@ -224,6 +224,7 @@ GameController::GameController(QObject* parent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (level == mLOG_FATAL) {
|
if (level == mLOG_FATAL) {
|
||||||
|
mCoreThreadMarkCrashed(controller->thread());
|
||||||
QMetaObject::invokeMethod(controller, "crashGame", Q_ARG(const QString&, QString().vsprintf(format, args)));
|
QMetaObject::invokeMethod(controller, "crashGame", Q_ARG(const QString&, QString().vsprintf(format, args)));
|
||||||
} else if (!(controller->m_logLevels & level)) {
|
} else if (!(controller->m_logLevels & level)) {
|
||||||
return;
|
return;
|
||||||
|
@ -556,9 +557,8 @@ void GameController::cleanGame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::crashGame(const QString& crashMessage) {
|
void GameController::crashGame(const QString& crashMessage) {
|
||||||
cleanGame();
|
closeGame();
|
||||||
emit gameCrashed(crashMessage);
|
emit gameCrashed(crashMessage);
|
||||||
emit gameStopped(&m_threadContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameController::isPaused() {
|
bool GameController::isPaused() {
|
||||||
|
|
Loading…
Reference in New Issue