From 37eace9db4fd00a3945d02ae984fa757b0532dea Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Thu, 5 Aug 2021 17:43:26 +0200 Subject: [PATCH] osx: lockup when emulator aborts. Race condition when starting emu --- core/hw/pvr/Renderer_if.cpp | 2 +- core/rend/mainui.cpp | 8 ++++++-- shell/apple/emulator-osx/emulator-osx/osx-main.mm | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/hw/pvr/Renderer_if.cpp b/core/hw/pvr/Renderer_if.cpp index 232e937d4..22e077cbd 100644 --- a/core/hw/pvr/Renderer_if.cpp +++ b/core/hw/pvr/Renderer_if.cpp @@ -380,11 +380,11 @@ void rend_start_render() if (QueueRender(ctx)) { palette_update(); + pend_rend = true; if (!config::ThreadedRendering) rend_single_frame(true); else rs.Set(); - pend_rend = true; } } } diff --git a/core/rend/mainui.cpp b/core/rend/mainui.cpp index 6fa9ef791..4447bcfb6 100644 --- a/core/rend/mainui.cpp +++ b/core/rend/mainui.cpp @@ -51,8 +51,12 @@ bool mainui_rend_frame() UpdateInputState(); if (!dc_is_running()) { - dc_stop(); - gui_stop_game(dc_get_last_error()); + std::string error = dc_get_last_error(); + if (!error.empty()) + { + dc_stop(); + gui_stop_game(error); + } } return false; } diff --git a/shell/apple/emulator-osx/emulator-osx/osx-main.mm b/shell/apple/emulator-osx/emulator-osx/osx-main.mm index 0bed48f41..ef7b293ef 100644 --- a/shell/apple/emulator-osx/emulator-osx/osx-main.mm +++ b/shell/apple/emulator-osx/emulator-osx/osx-main.mm @@ -118,7 +118,7 @@ extern bool rend_framePending(); bool emu_frame_pending() { - return rend_framePending() || gui_is_open(); + return rend_framePending() || !dc_is_running() || gui_is_open(); } bool emu_renderer_enabled()