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

Unified Diff: ui/views/controls/table/table_view.cc

Issue 1129233006: Fixes possible crash in TableView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | ui/views/controls/table/table_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/table/table_view.cc
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc
index 0b2d7355bd470b9e82ebefbd5cefbc419da872c4..d75ef1a023566372efb3055afadb59c743e56f72 100644
--- a/ui/views/controls/table/table_view.cc
+++ b/ui/views/controls/table/table_view.cc
@@ -485,6 +485,10 @@ void TableView::OnItemsRemoved(int start, int length) {
selection_model_.SetSelectedIndex(
ViewToModel(std::min(RowCount() - 1, previously_selected_view_index)));
}
+ if (!selection_model_.empty() && selection_model_.active() == -1)
+ selection_model_.set_active(FirstSelectedRow());
+ if (!selection_model_.empty() && selection_model_.anchor() == -1)
+ selection_model_.set_anchor(FirstSelectedRow());
if (table_view_observer_)
table_view_observer_->OnSelectionChanged();
}
« no previous file with comments | « no previous file | ui/views/controls/table/table_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698