Skip to content

Commit

Permalink
Fix regression adding folder to view (shows children until refreshed) (
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten authored Jul 10, 2023
1 parent d4b06f1 commit f026bf3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions libcore/Directory.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1074,19 +1074,20 @@ public class Files.Directory : Object {
bool already_present = false;
bool files_added = false;
Directory? first_dir = cache_lookup_parent (changes.data.from);
GLib.File? prev_loc = null;
if (first_dir != null) {
foreach (unowned var change in changes) {
unowned var loc = change.from;
// Each set or changes should refer to the same folder but check anyway
if (prev_loc == null || !loc.equal (prev_loc)) {
Files.File gof = first_dir.file_cache_find_or_insert (loc, out already_present, true);
// `change.from`` holds the location of the newly created file, not where it came from
var dir = cache_lookup_parent (change.from);
// Children of newly created folder must have null parent Files.Directory
// We expect each set of changes to refer to the same Directory
if (dir != null && dir == first_dir) {
Files.File gof = first_dir.file_cache_find_or_insert (change.from, out already_present, true);
if (!already_present) {
files_added = true;
first_dir.notify_file_added (gof, change.is_internal);
} // Else ignore files already added from duplicate event or internally

prev_loc = loc;
} else {
critical ("Unexpected parent of newly created file");
}
}

Expand Down

0 comments on commit f026bf3

Please sign in to comment.