summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/k_thread.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index 50cb5fc90..90de86770 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -308,14 +308,20 @@ void KThread::Finalize() {
308 308
309 auto it = waiter_list.begin(); 309 auto it = waiter_list.begin();
310 while (it != waiter_list.end()) { 310 while (it != waiter_list.end()) {
311 // Clear the lock owner 311 // Get the thread.
312 it->SetLockOwner(nullptr); 312 KThread* const waiter = std::addressof(*it);
313
314 // The thread shouldn't be a kernel waiter.
315 ASSERT(!IsKernelAddressKey(waiter->GetAddressKey()));
316
317 // Clear the lock owner.
318 waiter->SetLockOwner(nullptr);
313 319
314 // Erase the waiter from our list. 320 // Erase the waiter from our list.
315 it = waiter_list.erase(it); 321 it = waiter_list.erase(it);
316 322
317 // Cancel the thread's wait. 323 // Cancel the thread's wait.
318 it->CancelWait(ResultInvalidState, true); 324 waiter->CancelWait(ResultInvalidState, true);
319 } 325 }
320 } 326 }
321 327