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

Unified Diff: runtime/vm/message_handler.cc

Issue 2656613003: Store end_callback and callback_data into local variables before dropping the monitor (Closed)
Patch Set: Created 3 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 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/message_handler.cc
diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc
index adfda8e2fd6c95786c7787fa6c0f5dab389c31f6..936e711684f145dbea421ca7b2e4397934458d69 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -332,6 +332,8 @@ void MessageHandler::TaskCallback() {
MessageStatus status = kOK;
bool run_end_callback = false;
bool delete_me = false;
+ EndCallback end_callback = NULL;
+ CallbackData callback_data = NULL;
{
// We will occasionally release and reacquire this monitor in this
// function. Whenever we reacquire the monitor we *must* process
@@ -415,6 +417,8 @@ void MessageHandler::TaskCallback() {
}
pool_ = NULL;
// Decide if we have a callback before releasing the monitor.
+ end_callback = end_callback_;
+ callback_data = callback_data_;
run_end_callback = end_callback_ != NULL;
delete_me = delete_me_;
}
@@ -432,7 +436,8 @@ void MessageHandler::TaskCallback() {
ASSERT(!delete_me || !run_end_callback);
if (run_end_callback) {
siva 2017/01/24 19:24:25 is run_end_callback still needed, it could just be
- end_callback_(callback_data_);
+ ASSERT(end_callback != NULL);
+ end_callback(callback_data);
// The handler may have been deleted after this point.
}
if (delete_me) {
« 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