Index: runtime/vm/metrics.cc |
=================================================================== |
--- runtime/vm/metrics.cc (revision 39573) |
+++ runtime/vm/metrics.cc (working copy) |
@@ -51,10 +51,14 @@ |
Metric::~Metric() { |
- if (isolate_ == NULL) { |
- DeregisterWithVM(); |
- } else { |
- DeregisterWithIsolate(); |
+ // Only deregister metrics which had been registered. Metrics without a name |
+ // are from shallow copy isolates. |
+ if (name_ != NULL) { |
+ if (isolate_ == NULL) { |
+ DeregisterWithVM(); |
+ } else { |
+ DeregisterWithIsolate(); |
+ } |
} |
} |