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

Unified Diff: chrome/browser/ui/views/frame/contents_container.cc

Issue 13674016: alternate ntp: fix crash in ContentsContainer destructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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: chrome/browser/ui/views/frame/contents_container.cc
diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc
index 4603f9ad3e48af8d39346db592288a6423291ba2..94cd7123be82d4854bdcc1667f06cd7a48a67a00 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -98,6 +98,8 @@ void ContentsContainer::MakeOverlayContentsActiveContents() {
active_ = overlay_;
overlay_ = NULL;
overlay_web_contents_ = NULL;
+ // Unregister from observing previous |overlay_web_contents_|.
+ registrar_.RemoveAll();
// Since |overlay_| has been nuked, shadow view is not needed anymore.
// Note that the previous |active_| will be deleted by caller (see
// BrowserView::ActiveTabChanged()) after this call, hence removing the old
@@ -145,9 +147,8 @@ void ContentsContainer::SetOverlay(views::WebView* overlay,
if (overlay_web_contents_ != overlay_web_contents) {
#if !defined(OS_WIN)
- // Unregister from previous overlay web contents' render view host.
- if (overlay_web_contents_)
- registrar_.RemoveAll();
+ // Unregister from observing previous |overlay_web_contents_|.
+ registrar_.RemoveAll();
#endif // !defined(OS_WIN)
overlay_web_contents_ = overlay_web_contents;
@@ -273,6 +274,9 @@ void ContentsContainer::Observe(int type,
DCHECK_EQ(content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE,
type);
// Remove shadow view if it's not needed.
- if (overlay_ && !draw_drop_shadow_)
+ if (overlay_ && !draw_drop_shadow_ && overlay_web_contents_ &&
+ (content::Source<content::RenderWidgetHost>(source)).ptr() ==
sky 2013/04/05 19:44:17 Shouldn't this be a DCHECK?
kuan 2013/04/05 21:54:11 this is the dilemma i have: @159, GetRenderViewHos
sky 2013/04/05 23:00:08 Only register if rvh is non-null.
kuan 2013/04/05 23:10:54 Done.
+ overlay_web_contents_->GetRenderViewHost()) {
shadow_view_.reset();
+ }
}
« 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