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

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

Issue 7127001: Fix user-after-free error with ObserverList. The problem is that if an ObserverListBase::Iterato... (Closed) Base URL: svn://chrome-svn/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 87996)
+++ content/browser/renderer_host/render_view_host.cc (working copy)
@@ -606,16 +606,11 @@
if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(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;
- }
+ ObserverListBase<RenderViewHostObserver>::Iterator it(observers_);
+ RenderViewHostObserver* observer;
+ while ((observer = it.GetNext()) != NULL)
Evan Martin 2011/06/07 18:01:51 curlies on this while loop
+ if (observer->OnMessageReceived(msg))
+ return true;
if (delegate_->OnMessageReceived(msg))
return true;
« 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