diff options
Diffstat (limited to 'chrome/browser/views/frame/browser_view.cc')
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 91b148c..019fdc8 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -647,7 +647,10 @@ void BrowserView::TabSelectedAt(TabContents* old_contents, bool user_gesture) { DCHECK(old_contents != new_contents); - if (old_contents) + // We do not store the focus when closing the tab to work-around bug 4633. + // Some reports seem to show that the focus manager and/or focused view can + // be garbage at that point, it is not clear why. + if (old_contents && !old_contents->is_being_destroyed()) old_contents->StoreFocus(); // Update various elements that are interested in knowing the current @@ -659,8 +662,10 @@ void BrowserView::TabSelectedAt(TabContents* old_contents, // required to make features like Duplicate Tab, Undo Close Tab, // etc not result in sad tab. new_contents->DidBecomeSelected(); - if (BrowserList::GetLastActive() == browser_) + if (BrowserList::GetLastActive() == browser_ && + !browser_->tabstrip_model()->closing_all()) { new_contents->RestoreFocus(); + } // Update all the UI bits. UpdateTitleBar(); |