From 73d2c8fda8b7d324ab2b338b17bd10d36651f0f4 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 e41600c86..05f1dc26d 100644 --- a/CHANGES +++ b/CHANGES @@ -54,6 +54,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: Handle saving input settings better diff --git a/src/platform/perf-main.c b/src/platform/perf-main.c index 940a5ae4d..795bb8506 100644 --- a/src/platform/perf-main.c +++ b/src/platform/perf-main.c @@ -96,7 +96,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) {