diff options
author | Andreas Kling <kling@serenityos.org> | 2022-01-06 18:01:12 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-06 21:39:51 +0100 |
commit | a4337279611ad23e0b88b36dacba198bfc10a99b (patch) | |
tree | 34d1b0a1a51f2788e012ec7a09ba08d0f679fd67 | |
parent | 74311676cc32eff0154c29b2f8be0e64bd564cd3 (diff) | |
download | serenity-a4337279611ad23e0b88b36dacba198bfc10a99b.zip |
LibGUI: Avoid double hash lookup in ModelSelection::add()
-rw-r--r-- | Userland/Libraries/LibGUI/ModelSelection.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/ModelSelection.cpp b/Userland/Libraries/LibGUI/ModelSelection.cpp index 1aa22a3d64..825384c280 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.cpp +++ b/Userland/Libraries/LibGUI/ModelSelection.cpp @@ -29,10 +29,8 @@ void ModelSelection::set(const ModelIndex& index) void ModelSelection::add(const ModelIndex& index) { VERIFY(index.is_valid()); - if (m_indices.contains(index)) - return; - m_indices.set(index); - notify_selection_changed(); + if (m_indices.set(index) == AK::HashSetResult::InsertedNewEntry) + notify_selection_changed(); } void ModelSelection::add_all(const Vector<ModelIndex>& indices) |