From 677b408cd5fea8dda04869eb9ba94d9eeddbbad0 Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Mon, 16 Jan 2023 21:15:07 -0800 Subject: list-base: Fallback to add_files in file_changed We assume that the item associated with the given file in file_changed always exists. That assumption might fail, for example if renaming "a" to ".a" and then attempting an undo operation. If the item doesn't exist in the current model, simply fallback to add the item. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1513 --- src/nautilus-list-base.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c index 05385f561..cc79f16ea 100644 --- a/src/nautilus-list-base.c +++ b/src/nautilus-list-base.c @@ -62,6 +62,9 @@ struct _NautilusListBasePrivate G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (NautilusListBase, nautilus_list_base, NAUTILUS_TYPE_FILES_VIEW) +static void real_add_files (NautilusFilesView *files_view, + GList *files); + static const char * get_sort_attribute_from_sort_type (NautilusFileSortType sort_type) { @@ -1047,7 +1050,15 @@ real_file_changed (NautilusFilesView *files_view, NautilusViewItem *item; item = nautilus_view_model_get_item_from_file (priv->model, file); - nautilus_view_item_file_changed (item); + if (item != NULL) + { + nautilus_view_item_file_changed (item); + } + else + { + g_autoptr (GList) files = g_list_append (NULL, file); + real_add_files (files_view, files); + } } static GList * -- cgit v1.2.1