Commit graph

4 commits

Author SHA1 Message Date
Brandon Scott
a4d52b122d FileManager+LibGUI: Fix two folder-related crashes (#569)
Fix a crash when opening a folder, and another one when trying to open
a newly created folder.

It was not safe to modify a GModelSelection while it's being iterated over.

Fixes #536.
2019-09-17 09:26:10 +02:00
Andreas Kling
1cb661ae69 GModelSelection: Add size() and a const overload of for_each_index() 2019-09-12 18:42:15 +02:00
Andreas Kling
b0f42ee672 GModelSelection: Add contains_row(int) and toggle(GModelIndex) 2019-09-07 19:33:58 +02:00
Andreas Kling
82559e211d LibGUI: Add GModelSelection to help implementing multiple-select views
Each GAbstractView now has a GModelSelection backed by a simple
HashTable<GModelIndex>. When the selection changes somehow, the view
gets notified via the notify_selection_changed() callback.

In the future it will probably make sense to move to using some kind of
ranges as the internal representation instead.
2019-09-07 19:21:07 +02:00