LibGUI: Avoid double hash lookup in ModelSelection::add()

This commit is contained in:
Andreas Kling 2022-01-06 18:01:12 +01:00
commit a433727961
Notes: sideshowbarker 2024-07-17 21:32:06 +09:00

View file

@ -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)