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

Unified Diff: content/browser/renderer_host/render_view_host.cc

Issue 7134008: Revert 88151 (see crbug.com/85296) - Fix user-after-free error with ObserverList. The problem is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 | « base/observer_list_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_view_host.cc
===================================================================
--- content/browser/renderer_host/render_view_host.cc (revision 88283)
+++ content/browser/renderer_host/render_view_host.cc (working copy)
@@ -633,11 +633,15 @@
if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(msg))
return true;
- ObserverListBase<RenderViewHostObserver>::Iterator it(observers_);
- RenderViewHostObserver* observer;
- while ((observer = it.GetNext()) != NULL) {
- if (observer->OnMessageReceived(msg))
- return true;
+ {
+ // delegate_->OnMessageReceived can end up deleting |this|, in which case
+ // the destructor for ObserverListBase::Iterator would access the deleted
+ // observers_.
+ ObserverListBase<RenderViewHostObserver>::Iterator it(observers_);
+ RenderViewHostObserver* observer;
+ while ((observer = it.GetNext()) != NULL)
+ if (observer->OnMessageReceived(msg))
+ return true;
}
if (delegate_->OnMessageReceived(msg))
« no previous file with comments | « base/observer_list_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698