mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:58:12 +00:00
LibGUI: Fix assertion when handling removal of FileSystemModel's root
This commit fixes FileSystemModel behaviour when the root path of the model has been deleted. In this case, the model index resolved for the root path is invalid and passing it to 'begin_delete_rows' would trigger assertion failure. Instead of deleting all children rows one by one, we simply invalidate the whole model.
This commit is contained in:
parent
265b035dd5
commit
f7e6593910
1 changed files with 6 additions and 0 deletions
|
@ -418,6 +418,12 @@ void FileSystemModel::handle_file_event(Core::FileWatcherEvent const& event)
|
|||
break;
|
||||
}
|
||||
|
||||
if (&child.value() == m_root) {
|
||||
// Root directory of the filesystem model has been removed. All items became invalid.
|
||||
invalidate();
|
||||
break;
|
||||
}
|
||||
|
||||
auto index = child->index(0);
|
||||
begin_delete_rows(index.parent(), index.row(), index.row());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue