Index: mojo/public/cpp/bindings/lib/multiplex_router.cc |
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc |
index d081b0155ba480edf20fd4357b00f4d49f7ecb62..8b461ea2e92eff43fa2c8c162c5ae0dd9b45891f 100644 |
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc |
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc |
@@ -594,7 +594,7 @@ void MultiplexRouter::ProcessTasks( |
bool sync_message = task->IsMessageTask() && task->message && |
task->message->has_flag(kMessageIsSync); |
if (sync_message) { |
- InterfaceId id = task->message->interface_id(); |
+ id = task->message->interface_id(); |
auto& sync_message_queue = sync_message_tasks_[id]; |
DCHECK_EQ(task.get(), sync_message_queue.front()); |
sync_message_queue.pop_front(); |
@@ -608,11 +608,11 @@ void MultiplexRouter::ProcessTasks( |
current_task_runner); |
if (!processed) { |
- tasks_.push_front(std::move(task)); |
if (sync_message) { |
auto& sync_message_queue = sync_message_tasks_[id]; |
sync_message_queue.push_front(task.get()); |
} |
+ tasks_.push_front(std::move(task)); |
break; |
} else { |
if (sync_message) { |
@@ -643,7 +643,15 @@ bool MultiplexRouter::ProcessFirstSyncMessageForEndpoint(InterfaceId id) { |
DCHECK(processed); |
iter = sync_message_tasks_.find(id); |
- return iter != sync_message_tasks_.end() && !iter->second.empty(); |
+ if (iter == sync_message_tasks_.end()) |
+ return false; |
+ |
+ if (iter->second.empty()) { |
+ sync_message_tasks_.erase(iter); |
+ return false; |
+ } |
+ |
+ return true; |
} |
bool MultiplexRouter::ProcessNotifyErrorTask( |