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

Unified Diff: content/browser/android/java/gin_java_bridge_dispatcher_host.cc

Issue 455833005: Fixes bug in GinJavaBridgeDispatcherHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: %r Created 6 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: content/browser/android/java/gin_java_bridge_dispatcher_host.cc
diff --git a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
index 65263812a549ccffb39007b448c113629e8375d3..74ccaa21aaf6b0352edd3d971c6d1630524292ae 100644
--- a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
+++ b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
@@ -192,6 +192,10 @@ void GinJavaBridgeDispatcherHost::RemoveNamedObject(
if (iter == named_objects_.end())
return;
+ // |name| may come from |named_objects_|. Make a copy of name so that if
+ // |name| is from |named_objects_| it'll be valid after the remove below.
+ const std::string copied_name(name);
+
scoped_refptr<GinJavaBoundObject> object(*objects_.Lookup(iter->second));
named_objects_.erase(iter);
object->RemoveName();
@@ -210,7 +214,7 @@ void GinJavaBridgeDispatcherHost::RemoveNamedObject(
}
web_contents()->SendToAllFrames(
- new GinJavaBridgeMsg_RemoveNamedObject(MSG_ROUTING_NONE, name));
+ new GinJavaBridgeMsg_RemoveNamedObject(MSG_ROUTING_NONE, copied_name));
}
void GinJavaBridgeDispatcherHost::SetAllowObjectContentsInspection(bool allow) {
« 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