Index: runtime/vm/thread_registry.cc |
diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc |
index 264b844f453d716f9a4653a07b4807ae44baad2d..0d36e0d2575cac44dc1d0474baf0cbe140db0bc8 100644 |
--- a/runtime/vm/thread_registry.cc |
+++ b/runtime/vm/thread_registry.cc |
@@ -106,11 +106,11 @@ void ThreadRegistry::Unschedule(Thread* thread, |
OSThread* os_thread = thread->os_thread(); |
ASSERT(os_thread != NULL); |
os_thread->DisableThreadInterrupts(); |
+ os_thread->set_thread(NULL); |
+ OSThread::SetCurrent(os_thread); |
thread->isolate_ = NULL; |
thread->heap_ = NULL; |
thread->set_os_thread(NULL); |
- os_thread->set_thread(NULL); |
- OSThread::SetCurrent(os_thread); |
if (!is_mutator) { |
ASSERT(thread->api_top_scope() == NULL); |
ReturnThreadToFreelist(thread); |