From 23b2e25fb87603d0221feee75332f2553d2f1744 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 18 Jun 2016 20:58:58 -0500 Subject: [PATCH] XThread: Don't release ourselves before calling thread_->Terminate! --- src/xenia/kernel/xthread.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/xthread.cc b/src/xenia/kernel/xthread.cc index 81d11fa7f..1eaa5dce0 100644 --- a/src/xenia/kernel/xthread.cc +++ b/src/xenia/kernel/xthread.cc @@ -462,9 +462,14 @@ X_STATUS XThread::Terminate(int exit_code) { emulator()->processor()->OnThreadExit(thread_id_); running_ = false; - Release(); + if (XThread::IsInThread(this)) { + Release(); + xe::threading::Thread::Exit(exit_code); + } else { + thread_->Terminate(exit_code); + Release(); + } - thread_->Terminate(exit_code); return X_STATUS_SUCCESS; }