From efa7f9701269b9e4d8a3acac4e5de4b2bbc6282b Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 10 May 2015 08:22:03 -0700 Subject: [PATCH] Perf: Fix race condition if a game crashes immediately on start --- CHANGES | 1 + src/platform/perf-main.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGES b/CHANGES index 52e77c6df..a86c4b498 100644 --- a/CHANGES +++ b/CHANGES @@ -35,6 +35,7 @@ Bugfixes: - SDL: Fix potential build issues when Qt and SDL2 are in use - GBA Memory: Fix jumping to invalid memory when switching from Thumb to ARM - GBA Video: Fix second frame mode 5 + - Perf: Fix race condition if a game crashes immediately on start Misc: - Qt: Show multiplayer numbers in window title - Qt: Solar sensor can have shortcuts set diff --git a/src/platform/perf-main.c b/src/platform/perf-main.c index e22e513de..9581c8ff5 100644 --- a/src/platform/perf-main.c +++ b/src/platform/perf-main.c @@ -95,7 +95,14 @@ int main(int argc, char** argv) { if (!didStart) { goto cleanup; } + GBAThreadInterrupt(&context); + if (GBAThreadHasCrashed(&context)) { + GBAThreadJoin(&context); + goto cleanup; + } + GBAGetGameCode(context.gba, gameCode); + GBAThreadContinue(&context); int frames = perfOpts.frames; if (!frames) {