diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 95144ee09..c6f1853a3 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -138,7 +138,17 @@ void KernelState::set_process_type(uint32_t value) { uint32_t KernelState::AllocateTLS() { return uint32_t(tls_bitmap_.Acquire()); } -void KernelState::FreeTLS(uint32_t slot) { tls_bitmap_.Release(slot); } +void KernelState::FreeTLS(uint32_t slot) { + const std::vector> threads = + object_table()->GetObjectsByType(); + + for (const object_ref& thread : threads) { + if (thread->is_guest_thread()) { + thread->SetTLSValue(slot, 0); + } + } + tls_bitmap_.Release(slot); +} void KernelState::RegisterTitleTerminateNotification(uint32_t routine, uint32_t priority) {