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

Side by Side Diff: runtime/vm/isolate.cc

Issue 9288001: Don't access a message after it has been enqueued. It may be deleted (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/bigint_store.h" 9 #include "vm/bigint_store.h"
10 #include "vm/code_index_table.h" 10 #include "vm/code_index_table.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 if (source_isolate) { 93 if (source_isolate) {
94 source_name = source_isolate->name(); 94 source_name = source_isolate->name();
95 } 95 }
96 OS::Print("[>] Posting message:\n" 96 OS::Print("[>] Posting message:\n"
97 "\tsource: %s\n" 97 "\tsource: %s\n"
98 "\treply_port: %lld\n" 98 "\treply_port: %lld\n"
99 "\tdest: %s\n" 99 "\tdest: %s\n"
100 "\tdest_port: %lld\n", 100 "\tdest_port: %lld\n",
101 source_name, message->reply_port(), name(), message->dest_port()); 101 source_name, message->reply_port(), name(), message->dest_port());
102 } 102 }
103
104 Message::Priority priority = message->priority();
103 message_queue()->Enqueue(message); 105 message_queue()->Enqueue(message);
104 ASSERT(message->priority() < Message::kOOBPriority); 106 message = NULL; // Do not access message. May have been deleted.
105 if (message->priority() >= Message::kOOBPriority) { 107
108 ASSERT(priority < Message::kOOBPriority);
siva 2012/01/26 00:01:46 Shouldn't this assert be after the if check?
109 if (priority >= Message::kOOBPriority) {
106 // Handle out of band messages even if the isolate is busy. 110 // Handle out of band messages even if the isolate is busy.
107 ScheduleInterrupts(Isolate::kMessageInterrupt); 111 ScheduleInterrupts(Isolate::kMessageInterrupt);
108 } 112 }
109 Dart_MessageNotifyCallback callback = message_notify_callback(); 113 Dart_MessageNotifyCallback callback = message_notify_callback();
110 if (callback) { 114 if (callback) {
111 // Allow the embedder to handle message notification. 115 // Allow the embedder to handle message notification.
112 (*callback)(Api::CastIsolate(this)); 116 (*callback)(Api::CastIsolate(this));
113 } 117 }
114 } 118 }
115 119
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 424 }
421 425
422 426
423 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) { 427 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) {
424 if (api_state() != NULL) { 428 if (api_state() != NULL) {
425 api_state()->VisitWeakHandles(visitor); 429 api_state()->VisitWeakHandles(visitor);
426 } 430 }
427 } 431 }
428 432
429 } // namespace dart 433 } // namespace dart
OLDNEW
« 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