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

Unified Diff: chrome/browser/views/frame/browser_view.cc

Issue 126082: Fix a crash when closing an incognito window (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « chrome/browser/views/frame/browser_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/frame/browser_view.cc
===================================================================
--- chrome/browser/views/frame/browser_view.cc (revision 18427)
+++ chrome/browser/views/frame/browser_view.cc (working copy)
@@ -274,7 +274,6 @@
active_bookmark_bar_(NULL),
tabstrip_(NULL),
toolbar_(NULL),
- download_shelf_(NULL),
infobar_container_(NULL),
find_bar_y_(0),
contents_container_(NULL),
@@ -298,6 +297,12 @@
ticker_.UnregisterTickHandler(&hung_window_detector_);
#endif
+ // We destroy the download shelf before |browser_| to remove its child
+ // download views from the set of download observers (since the observed
+ // downloads can be destroyed along with |browser_| and the observer
+ // notifications will call back into deleted objects).
+ download_shelf_.reset();
+
// Explicitly set browser_ to NULL
browser_.reset();
}
@@ -787,7 +792,7 @@
// shelf, so we don't want others to do it for us in this case.
// Currently, the only visible bottom shelf is the download shelf.
// Other tests should be added here if we add more bottom shelves.
- if (download_shelf_ && download_shelf_->IsShowing()) {
+ if (download_shelf_.get() && download_shelf_->IsShowing()) {
return gfx::Rect();
}
@@ -842,13 +847,15 @@
}
bool BrowserView::IsDownloadShelfVisible() const {
- return download_shelf_ && download_shelf_->IsShowing();
+ return download_shelf_.get() && download_shelf_->IsShowing();
}
DownloadShelf* BrowserView::GetDownloadShelf() {
- if (!download_shelf_)
- download_shelf_ = new DownloadShelfView(browser_.get(), this);
- return download_shelf_;
+ if (!download_shelf_.get()) {
+ download_shelf_.reset(new DownloadShelfView(browser_.get(), this));
+ download_shelf_->SetParentOwned(false);
+ }
+ return download_shelf_.get();
}
void BrowserView::ShowReportBugDialog() {
@@ -1493,7 +1500,7 @@
if (IsDownloadShelfVisible()) {
bool visible = browser_->SupportsWindowFeature(
Browser::FEATURE_DOWNLOADSHELF);
- DCHECK(download_shelf_);
+ DCHECK(download_shelf_.get());
int height = visible ? download_shelf_->GetPreferredSize().height() : 0;
download_shelf_->SetVisible(visible);
download_shelf_->SetBounds(0, bottom - height, width(), height);
« no previous file with comments | « chrome/browser/views/frame/browser_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698