Skip to content

Commit d9b1301

Browse files
committed
VM: Fix crash in profile signal handler.
The profile signal handler may interrupt when the current Thread is in an inconsistent state. Members of the Thread that is unscheduled are NULLed out before OSThread::SetCurrent sets a new current Thread. Fix this by resetting the current Thread's fields after a new Thread is set as current. BUG=#25702 [email protected] Review URL: https://codereview.chromium.org/1491283002 .
1 parent 072aaae commit d9b1301

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

runtime/vm/thread_registry.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ void ThreadRegistry::Unschedule(Thread* thread,
106106
OSThread* os_thread = thread->os_thread();
107107
ASSERT(os_thread != NULL);
108108
os_thread->DisableThreadInterrupts();
109+
os_thread->set_thread(NULL);
110+
OSThread::SetCurrent(os_thread);
109111
thread->isolate_ = NULL;
110112
thread->heap_ = NULL;
111113
thread->set_os_thread(NULL);
112-
os_thread->set_thread(NULL);
113-
OSThread::SetCurrent(os_thread);
114114
if (!is_mutator) {
115115
ASSERT(thread->api_top_scope() == NULL);
116116
ReturnThreadToFreelist(thread);

0 commit comments

Comments
 (0)