Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1315)

Unified Diff: runtime/vm/isolate.cc

Issue 1307833002: - Prevent interrupting the NULL thread when the isolate is (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 669ae2caaac34e29413dbda005229929babafa9a..4119234a1e16604f5d7eb3fc6c800e166716f0a8 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1766,7 +1766,12 @@ intptr_t Isolate::ProfileInterrupt() {
// Paused at start / exit . Don't tick.
return 0;
}
- if (mutator_thread_ == NULL) {
+ // Make sure that the isolate's mutator thread does not change behind our
+ // backs. Otherwise we find the entry in the registry and end up reading
+ // the field again. Only by that time it has been reset to NULL because the
+ // thread was in process of exiting the isolate.
+ Thread* mutator = mutator_thread_;
+ if (mutator == NULL) {
// No active mutator.
ProfileIdle();
return 1;
@@ -1778,8 +1783,8 @@ intptr_t Isolate::ProfileInterrupt() {
ThreadRegistry::EntryIterator it(thread_registry());
while (it.HasNext()) {
const ThreadRegistry::Entry& entry = it.Next();
- if (entry.thread == mutator_thread_) {
- ThreadInterrupter::InterruptThread(mutator_thread_);
+ if (entry.thread == mutator) {
+ ThreadInterrupter::InterruptThread(mutator);
break;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698