all repos — mgba @ 98a6510b927d969e22043c5a1caedadc9e7204b4

mGBA Game Boy Advance Emulator

Qt: Fix race condition when a game crashes immediately
Jeffrey Pfau jeffrey@endrift.com
Sun, 04 Jan 2015 19:01:26 -0800
commit

98a6510b927d969e22043c5a1caedadc9e7204b4

parent

811ad23e6175142fabaaee031ad3e6d58e2bb910

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

jump to
M CHANGESCHANGES

@@ -39,6 +39,7 @@ - GBA Video: Fix window interactions with 16-color mode 0 mosaic

- GBA Video: Fix sprite boundary conditions with mosaic - Video: Fix FFmpeg crashing when the file extension is wrong - GBA Audio: Fix GB audio channels being too quiet (fixes #159) + - Qt: Fix a race condition when a game crashes immediately Misc: - Qt: Disable sync to video by default - GBA: Exit cleanly on FATAL if the port supports it
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -332,13 +332,20 @@ }

} void Window::gameStarted(GBAThread* context) { - emit startDrawing(m_controller->drawContext(), context); + char title[13] = { '\0' }; + MutexLock(&context->stateMutex); + if (context->state < THREAD_EXITING) { + emit startDrawing(m_controller->drawContext(), context); + GBAGetGameTitle(context->gba, title); + } else { + MutexUnlock(&context->stateMutex); + return; + } + MutexUnlock(&context->stateMutex); foreach (QAction* action, m_gameActions) { action->setDisabled(false); } appendMRU(context->fname); - char title[13] = { '\0' }; - GBAGetGameTitle(context->gba, title); setWindowTitle(tr(PROJECT_NAME " - %1").arg(title)); attachWidget(m_display); m_screenWidget->setScaledContents(true);