From 7ebd3bbcbf574dc988c7347e7ed2fa05b18d65a8 Mon Sep 17 00:00:00 2001 From: RipleyTom Date: Sun, 30 Dec 2018 15:39:40 +0100 Subject: [PATCH] Fixes issues where the mutex is destroyed while an unlock is happening --- rpcs3/Emu/Cell/lv2/sys_mutex.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp index 97e94aeeae..a0db66c096 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mutex.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mutex.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/Memory/vm.h" #include "Emu/System.h" #include "Emu/IdManager.h" @@ -80,6 +80,8 @@ error_code sys_mutex_destroy(u32 mutex_id) const auto mutex = idm::withdraw(mutex_id, [](lv2_mutex& mutex) -> CellError { + std::lock_guard lock(mutex.mutex); + if (mutex.owner || mutex.lock_count) { return CELL_EBUSY;