summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-16 16:23:43 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-16 16:44:09 +0200
commita66e55ec644afee138e6f6836d877feb91ff33f7 (patch)
tree37789cc201211d6f81c0fb9df9ef8c02b41edc91 /Libraries/LibGUI
parent9102b624ac6b83d4e4418fecefd491f67d4603f8 (diff)
downloadserenity-a66e55ec644afee138e6f6836d877feb91ff33f7.zip
LibGUI: Make SortingProxyModel clear view selections aggressively
When invalidating all indexes, tell all attached views to just wipe their selections. This is the best we can do for now.
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/SortingProxyModel.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Libraries/LibGUI/SortingProxyModel.cpp b/Libraries/LibGUI/SortingProxyModel.cpp
index 1eccc363bd..45ff283e0b 100644
--- a/Libraries/LibGUI/SortingProxyModel.cpp
+++ b/Libraries/LibGUI/SortingProxyModel.cpp
@@ -44,10 +44,16 @@ SortingProxyModel::~SortingProxyModel()
void SortingProxyModel::invalidate(unsigned int flags)
{
- if (flags == UpdateFlag::DontInvalidateIndexes)
+ if (flags == UpdateFlag::DontInvalidateIndexes) {
sort(m_last_key_column, m_last_sort_order);
- else
+ } else {
m_mappings.clear();
+
+ // FIXME: This is really harsh, but without precise invalidation, not much we can do.
+ for_each_view([&](auto& view) {
+ view.selection().clear();
+ });
+ }
did_update(flags);
}