summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-08 00:45:31 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-08 00:45:31 +0000
commit71c7885ed81d49cb044498cd0f07db700b390655 (patch)
tree6a6f935c05904b754e8d99c8a9440dc34f58520d /chrome
parente83f16853d443dd0556b7e8c42f1f6013581715d (diff)
downloadchromium_src-71c7885ed81d49cb044498cd0f07db700b390655.zip
chromium_src-71c7885ed81d49cb044498cd0f07db700b390655.tar.gz
chromium_src-71c7885ed81d49cb044498cd0f07db700b390655.tar.bz2
Make sure the browser is destroyed during DestroyBrowser because EndSession handling needs it to be synchronously deleted, rather than by the Window's destruction.
B=1031854 Review URL: http://codereview.chromium.org/452 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/frame/browser_view2.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc
index 64c210d..31259b7 100644
--- a/chrome/browser/views/frame/browser_view2.cc
+++ b/chrome/browser/views/frame/browser_view2.cc
@@ -438,6 +438,11 @@ void BrowserView2::FocusToolbar() {
}
void BrowserView2::DestroyBrowser() {
+ // Explicitly delete the BookmarkBarView now. That way we don't have to
+ // worry about the BookmarkBarView potentially outliving the Browser &
+ // Profile.
+ bookmark_bar_view_.reset();
+ browser_.reset();
}
bool BrowserView2::IsBookmarkBarVisible() const {
@@ -472,7 +477,10 @@ void BrowserView2::Observe(NotificationType type,
// BrowserView2, TabStripModelObserver implementation:
void BrowserView2::TabDetachedAt(TabContents* contents, int index) {
- if (contents == browser_->GetSelectedTabContents()) {
+ // We use index here rather than comparing |contents| because by this time
+ // the model has already removed |contents| from its list, so
+ // browser_->GetSelectedTabContents() will return NULL or something else.
+ if (index == browser_->tabstrip_model()->selected_index()) {
// We need to reset the current tab contents to NULL before it gets
// freed. This is because the focus manager performs some operations
// on the selected TabContents when it is removed.