From 6648a9c225b67a5aa647a31e131fc47828293a03 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Tue, 24 Mar 2026 03:33:53 +0100 Subject: [PATCH] coreinit: Log errors in OSUnlockMutex instead of debug asserts --- .../OS/libs/coreinit/coreinit_Synchronization.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp index e81cc577..4f85537b 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp @@ -300,8 +300,16 @@ namespace coreinit void OSUnlockMutexInternal(OSMutex* mutex) { OSThread_t* currentThread = OSGetCurrentThread(); - cemu_assert_debug(mutex->owner == currentThread); - cemu_assert_debug(mutex->lockCount > 0); + if (mutex->lockCount == 0) + { + cemuLog_log(LogType::APIErrors, "OSUnlockMutex called on a mutex which is not locked"); + return; + } + if (mutex->owner != currentThread) + { + cemuLog_log(LogType::APIErrors, "OSUnlockMutex called by a different thread than the one owning it (owner=0x{:08x} currentThread=0x{:08x})", mutex->owner.GetMPTR(), MEMPTR(currentThread).GetMPTR()); + return; + } mutex->lockCount = mutex->lockCount - 1; if (mutex->lockCount == 0) {