mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
sys_spu: Fix oops in sys_raw_spu_destroy after #7782
'id' is not the idm id, also explicitly join the thread so a situation where the thread is still active and communicating other threads (e.g via MMIO or MFC) yet its ID is removed won't happen. (logic breakage, destroyed thread can't be active)
This commit is contained in:
parent
664d606123
commit
a9f492b605
1 changed files with 6 additions and 2 deletions
|
@ -1690,7 +1690,9 @@ error_code sys_raw_spu_destroy(ppu_thread& ppu, u32 id)
|
|||
|
||||
sys_spu.warning("sys_raw_spu_destroy(id=%d)", id);
|
||||
|
||||
auto thread = idm::get<named_thread<spu_thread>>(spu_thread::find_raw_spu(id), [](named_thread<spu_thread>& thread)
|
||||
const u32 idm_id = spu_thread::find_raw_spu(id);
|
||||
|
||||
auto thread = idm::get<named_thread<spu_thread>>(idm_id, [](named_thread<spu_thread>& thread)
|
||||
{
|
||||
// Stop thread
|
||||
thread.state += cpu_flag::exit;
|
||||
|
@ -1745,7 +1747,9 @@ error_code sys_raw_spu_destroy(ppu_thread& ppu, u32 id)
|
|||
idm::remove_verify<lv2_obj, lv2_int_serv>(pair.second, std::move(pair.first));
|
||||
}
|
||||
|
||||
if (!idm::remove_verify<named_thread<spu_thread>>(id, std::move(thread)))
|
||||
(*thread)();
|
||||
|
||||
if (!idm::remove_verify<named_thread<spu_thread>>(idm_id, std::move(thread)))
|
||||
{
|
||||
// Other thread destroyed beforehead
|
||||
return CELL_ESRCH;
|
||||
|
|
Loading…
Add table
Reference in a new issue