| Index: runtime/vm/dart_api_state.h
|
| diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
|
| index 2565bfe6bc41b7a686dceacd75539c00d9222318..4f2935409941f9de21e87234200e771d9a31995d 100644
|
| --- a/runtime/vm/dart_api_state.h
|
| +++ b/runtime/vm/dart_api_state.h
|
| @@ -53,6 +53,12 @@ class ApiZone {
|
| // Delete all memory associated with the zone.
|
| ~ApiZone() {
|
| Isolate* isolate = Isolate::Current();
|
| +#if defined(DEBUG)
|
| + if (isolate == NULL) {
|
| + ASSERT(zone_.handles()->CountScopedHandles() == 0);
|
| + ASSERT(zone_.handles()->CountZoneHandles() == 0);
|
| + }
|
| +#endif
|
| if ((isolate != NULL) && (isolate->current_zone() == &zone_)) {
|
| isolate->set_current_zone(zone_.previous_);
|
| }
|
| @@ -636,7 +642,12 @@ class ApiNativeScope {
|
| OSThread::GetThreadLocal(Api::api_native_key_));
|
| }
|
|
|
| - Zone* zone() { return zone_.GetZone(); }
|
| + Zone* zone() {
|
| + Zone* result = zone_.GetZone();
|
| + ASSERT(result->handles()->CountScopedHandles() == 0);
|
| + ASSERT(result->handles()->CountZoneHandles() == 0);
|
| + return result;
|
| + }
|
|
|
| private:
|
| ApiZone zone_;
|
|
|