diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 910c64bf7..7dd91a456 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -141,7 +141,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) {