XThread: Don't release ourselves before calling thread_->Terminate!

This commit is contained in:
Dr. Chat 2016-06-18 20:58:58 -05:00
parent b82f6a990a
commit 23b2e25fb8
1 changed files with 7 additions and 2 deletions

View File

@ -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;
}