| Index: runtime/vm/dart_api_state.h
|
| diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
|
| index 34b9f9a0995c0e380d888ee3ef39d4106c4392cd..f9d10125b8083dabb9e218c5cb8b15ae2496ca42 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_);
|
| }
|
| @@ -632,7 +638,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_;
|
|
|