mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
LibGUI: Reify intermediate nodes during index traversal
In the event where you want to find the index of a deeply-nested path with a GFileSystemModel that hasn't yet traversed most of that path, it is possible for a false negative failure to occur. This failure is caused by the GFileSystemModel incorrectly bailing out of the search when it hits the first unseen path segment that is not at the very end of the path. This patch fixes this problem by reifying the intermediate nodes during that search and traversal process.
This commit is contained in:
parent
246c011497
commit
9b6e99f17e
Notes:
sideshowbarker
2024-07-19 12:58:37 +09:00
Author: https://github.com/deoxxa Commit: https://github.com/SerenityOS/serenity/commit/9b6e99f17ee Pull-request: https://github.com/SerenityOS/serenity/pull/392
@ -107,6 +107,7 @@ GModelIndex GFileSystemModel::index(const StringView& path) const
|
||||
bool found = false;
|
||||
for (auto& child : node->children) {
|
||||
if (child->name == part) {
|
||||
child->reify_if_needed(*this);
|
||||
node = child;
|
||||
found = true;
|
||||
if (i == canonical_path.parts().size() - 1)
|
||||
|
Loading…
Reference in New Issue
Block a user