Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

Fix crash caused by 2238.

Fernando Sahmkow18ca210bb73d
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index d9ffebc3ff..3b22e8e0d2 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -314,8 +314,9 @@ void Thread::UpdatePriority() {
}
// Ensure that the thread is within the correct location in the waiting list.
+ auto old_owner = lock_owner;
lock_owner->RemoveMutexWaiter(this);
- lock_owner->AddMutexWaiter(this);
+ old_owner->AddMutexWaiter(this);
// Recursively update the priority of the thread that depends on the priority of this one.
lock_owner->UpdatePriority();