[gnome-builder] recent: be more careful about directory reaping



commit 8cee72c1e0ff11d3f6e613af52524e21752eba0b
Author: Christian Hergert <chergert redhat com>
Date:   Thu Apr 19 17:06:41 2018 -0700

    recent: be more careful about directory reaping

 src/plugins/recent/gbp-recent-section.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/recent/gbp-recent-section.c b/src/plugins/recent/gbp-recent-section.c
index 1573dcd02..c2b1e5182 100644
--- a/src/plugins/recent/gbp-recent-section.c
+++ b/src/plugins/recent/gbp-recent-section.c
@@ -322,7 +322,14 @@ gbp_recent_section_purge_selected (IdeGreeterSection *section)
       g_assert (G_IS_FILE (directory) || G_IS_FILE (file));
 
       if (directory == NULL)
-        directory = parent = g_file_get_parent (file);
+        {
+          if (g_file_query_file_type (file, 0, NULL) == G_FILE_TYPE_DIRECTORY)
+            directory = g_object_ref (file);
+          else
+            directory = parent = g_file_get_parent (file);
+        }
+
+      g_assert (G_IS_FILE (directory));
 
       dzl_directory_reaper_add_directory (reaper, directory, 0);
       g_ptr_array_add (directories, g_object_ref (directory));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]