diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 6c2163f117..7b2b17aaa9 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -839,7 +839,7 @@ void ppu_thread::fast_call(u32 addr, u32 rtoc) return fmt::format("%s [0x%08x]", thread_ctrl::get_name(), _this->cia); }; - auto at_ret = gsl::finally([&]() + auto at_ret = [&]() { if (std::uncaught_exceptions()) { @@ -866,9 +866,19 @@ void ppu_thread::fast_call(u32 addr, u32 rtoc) current_function = old_func; g_tls_log_prefix = old_fmt; } - }); + }; - exec_task(); + try + { + exec_task(); + } + catch (...) + { + at_ret(); + throw; + } + + at_ret(); } u32 ppu_thread::stack_push(u32 size, u32 align_v)