From 4d3c06ffe3f3a06adb028cddcaaaa5c1b7d42295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Harald=20J=C3=B8rgensen?= <58829763+adamjoer@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:18:31 +0200 Subject: [PATCH] LibGUI: Fetch data on a Node before traversing it, instead of after Before this it wouldn't be possible to make decisions in Node::traverse_if_needed based on the Node data because it would be invalid. --- Userland/Libraries/LibGUI/FileSystemModel.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index e0508965b2..883883d296 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -185,10 +185,9 @@ OwnPtr FileSystemModel::Node::create_child(DeprecatedStri void FileSystemModel::Node::reify_if_needed() { + if (mode == 0) + fetch_data(full_path(), m_parent == nullptr || m_parent->m_parent_of_root); traverse_if_needed(); - if (mode != 0) - return; - fetch_data(full_path(), m_parent == nullptr || m_parent->m_parent_of_root); } bool FileSystemModel::Node::is_symlink_to_directory() const