Index: src/zone.h |
=================================================================== |
--- src/zone.h (revision 1950) |
+++ src/zone.h (working copy) |
@@ -180,10 +180,15 @@ |
nesting_++; |
} |
- ~ZoneScope() { |
- if (--nesting_ == 0 && mode_ == DELETE_ON_EXIT) Zone::DeleteAll(); |
+ virtual ~ZoneScope() { |
+ if (ShouldDeleteOnExit()) Zone::DeleteAll(); |
+ --nesting_; |
} |
+ bool ShouldDeleteOnExit() { |
+ return nesting_ == 1 && mode_ == DELETE_ON_EXIT; |
+ } |
+ |
// For ZoneScopes that do not delete on exit by default, call this |
// method to request deletion on exit. |
void DeleteOnExit() { |