Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| =================================================================== |
| --- runtime/vm/isolate.cc (revision 21561) |
| +++ runtime/vm/isolate.cc (working copy) |
| @@ -885,18 +885,28 @@ |
| if (status_sync == NULL) { |
| status_sync = new Monitor(); |
| } |
| - ScheduleInterrupts(Isolate::kVmStatusInterrupt); |
| - { |
| - MonitorLocker ml(status_sync); |
| - if (stacktrace_ == NULL) { // It may already be available. |
| - ml.Wait(); |
| + if (is_runnable()) { |
| + ScheduleInterrupts(Isolate::kVmStatusInterrupt); |
| + { |
| + MonitorLocker ml(status_sync); |
| + if (stacktrace_ == NULL) { // It may already be available. |
| + ml.Wait(); |
|
Ivan Posva
2013/04/16 19:09:19
Please wait with a timeout to avoid the hanging ar
Tom Ball
2013/04/16 20:40:23
Done.
|
| + } |
| } |
| + SetVmStatsCallback(NULL); |
| } |
| - SetVmStatsCallback(NULL); |
| - ASSERT(stacktrace_ != NULL); |
| - // result is freed by VmStats::WebServer(). |
| char* result = stacktrace_; |
| stacktrace_ = NULL; |
| + if (result == NULL) { |
| + // Return empty stack. |
| + TextBuffer buffer(256); |
| + buffer.Printf("{ \"handle\": \"0x%"Px64"\", \"stacktrace\": []}", |
| + reinterpret_cast<int64_t>(this)); |
| + |
| + result = strndup(buffer.buf(), buffer.length()); |
| + } |
| + ASSERT(result != NULL); |
| + // result is freed by VmStats::WebServer(). |
| return result; |
| } |