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

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

Issue 2026793002: TableView: use a stable_sort instead of a sort, since the comparisons may not be totally ordered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | no next file » | 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 c09c6ead90525ab3be40307bb7e5acc1703b4d5b..9ef4fe95a81979c279f87de6411fcd19cdd168a3 100644
--- a/ui/views/controls/table/table_view.cc
+++ b/ui/views/controls/table/table_view.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <algorithm>
#include <map>
#include <utility>
@@ -660,9 +661,11 @@ void TableView::SortItemsAndUpdateMapping() {
GroupSortHelper sort_helper(this);
GetModelIndexToRangeStart(grouper_, RowCount(),
&sort_helper.model_index_to_range_start);
- std::sort(view_to_model_.begin(), view_to_model_.end(), sort_helper);
+ std::stable_sort(view_to_model_.begin(), view_to_model_.end(),
+ sort_helper);
} else {
- std::sort(view_to_model_.begin(), view_to_model_.end(), SortHelper(this));
+ std::stable_sort(view_to_model_.begin(), view_to_model_.end(),
+ SortHelper(this));
}
for (int i = 0; i < row_count; ++i)
model_to_view_[view_to_model_[i]] = i;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698