Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
unset the selection if the active tab is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed May 25, 2017
1 parent 6df35b0 commit 4fdf666
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions chromium_src/chrome/browser/ui/tabs/tab_strip_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ WebContents* TabStripModel::DetachWebContentsAt(int index) {
for (auto& observer : observers_)
observer.TabDetachedAt(removed_contents, index);

if (active_index() == index) {
ui::ListSelectionModel new_model;
new_model.Copy(selection_model_);
new_model.SetSelectedIndex(kNoTab);
selection_model_.Copy(new_model);
}

if (empty()) {
selection_model_.Clear();
// TabDetachedAt() might unregister observers, so send |TabStripEmpty()| in
Expand Down

2 comments on commit 4fdf666

@bridiver
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part of fix for brave/browser-laptop#9021

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.