| Index: runtime/vm/thread.cc
|
| diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
|
| index 9f08a73e107e21bae928e2c1fd2cd879346c8885..56c25af41b5d8144a628c5dd909f72cf0e734876 100644
|
| --- a/runtime/vm/thread.cc
|
| +++ b/runtime/vm/thread.cc
|
| @@ -223,6 +223,11 @@ void Thread::ExitIsolate() {
|
| Thread* thread = Thread::Current();
|
| // TODO(koda): Audit callers; they should know whether they're in an isolate.
|
| if (thread == NULL || thread->isolate() == NULL) return;
|
| +#if defined(DEBUG)
|
| + ASSERT(!thread->IsAnyReusableHandleScopeActive());
|
| +#endif // DEBUG
|
| + // Clear since GC will not visit the thread once it is unscheduled.
|
| + thread->ClearReusableHandles();
|
| Isolate* isolate = thread->isolate();
|
| Profiler::EndExecution(isolate);
|
| thread->Unschedule();
|
| @@ -237,9 +242,6 @@ void Thread::ExitIsolate() {
|
| thread->isolate_ = NULL;
|
| ASSERT(Isolate::Current() == NULL);
|
| thread->heap_ = NULL;
|
| -#if defined(DEBUG)
|
| - ASSERT(!thread->IsAnyReusableHandleScopeActive());
|
| -#endif // DEBUG
|
| }
|
|
|
|
|
| @@ -348,6 +350,14 @@ C* Thread::AllocateReusableHandle() {
|
| }
|
|
|
|
|
| +void Thread::ClearReusableHandles() {
|
| +#define CLEAR_REUSABLE_HANDLE(object) \
|
| + *object##_handle_ = object::null();
|
| + REUSABLE_HANDLE_LIST(CLEAR_REUSABLE_HANDLE)
|
| +#undef CLEAR_REUSABLE_HANDLE
|
| +}
|
| +
|
| +
|
| void Thread::VisitObjectPointers(ObjectPointerVisitor* visitor) {
|
| ASSERT(visitor != NULL);
|
|
|
|
|