From 9dd4a7f87c422bf2043e8dca9d7e7f148c95fa80 Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Tue, 11 Apr 2023 12:17:31 -0700 Subject: files-view: Don't add non-existent files Under certain circumstances (i.e. moving a file), we end up adding a non-existent file. This causes selection problems because the non-existent file is selected and then removed (causing another file to be selected). I'm not sure where the root cause is (between directory-async, directory notify, etc), but lets simply not add a file that we know shouldn't be added. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2828 --- src/nautilus-files-view.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index abc9a39b7..adce3f519 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -4341,6 +4341,11 @@ process_old_files (NautilusFilesView *view) for (GList *node = files_added; node != NULL; node = node->next) { pending = node->data; + if (nautilus_file_is_gone (pending->file)) + { + g_warning ("Attempted to add a non-existent file to the view."); + continue; + } pending_additions = g_list_prepend (pending_additions, pending->file); /* Acknowledge the files that were pending to be revealed */ if (g_hash_table_contains (priv->pending_reveal, pending->file)) -- cgit v1.2.1