Index: runtime/vm/thread.cc |
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc |
index 0fa2d403f06f2e5fa2a59886046097e637225ff6..c5c6e70a7bb8524c897de04779dcfa75b19f837f 100644 |
--- a/runtime/vm/thread.cc |
+++ b/runtime/vm/thread.cc |
@@ -24,6 +24,15 @@ namespace dart { |
Thread::~Thread() { |
// We should cleanly exit any isolate before destruction. |
ASSERT(isolate_ == NULL); |
+ // There should be no top api scopes at this point. |
+ ASSERT(api_top_scope() == NULL); |
+ // Delete the resusable api scope if there is one. |
+ if (api_reusable_scope_) { |
+ delete api_reusable_scope_; |
+ api_reusable_scope_ = NULL; |
+ } |
+ delete thread_lock_; |
+ thread_lock_ = NULL; |
} |