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

Unified Diff: content/browser/devtools/render_frame_devtools_agent_host.cc

Issue 2597453002: devtools: Fix crash when WebContents is deleted by a message handler (Closed)
Patch Set: Created 4 years 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: content/browser/devtools/render_frame_devtools_agent_host.cc
diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc
index cc06aa8418003421d082b02d09cc6e579c5d2b25..c8bd69438eef9499073e2a3cb0d4d58e890741d8 100644
--- a/content/browser/devtools/render_frame_devtools_agent_host.cc
+++ b/content/browser/devtools/render_frame_devtools_agent_host.cc
@@ -242,13 +242,15 @@ void RenderFrameDevToolsAgentHost::FrameHostHolder::SendMessageToClient(
int session_id,
const std::string& message) {
int id = chunk_processor_.last_call_id();
+ PendingMessage sent_message = sent_messages_[id];
+ sent_messages_.erase(id);
if (suspended_) {
- sent_messages_whose_reply_came_while_suspended_[id] = sent_messages_[id];
+ sent_messages_whose_reply_came_while_suspended_[id] = sent_message;
pending_messages_.push_back(std::make_pair(session_id, message));
} else {
agent_->SendMessageToClient(session_id, message);
+ // |this| may be deleted at this point.
}
- sent_messages_.erase(id);
}
void RenderFrameDevToolsAgentHost::FrameHostHolder::Suspend() {
« 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