[nautilus/wip/ernestask/leak-plugging: 1/3] directory: Free list as well as unref items



commit 58a44ea9f1ef321fdb9e26f6ef254732fee6066a
Author: Ernestas Kulik <ernestask gnome org>
Date:   Fri Oct 5 18:24:05 2018 +0300

    directory: Free list as well as unref items
    
    filtering_changed_callback() populates a list of directories, but never
    frees the list.

 src/nautilus-directory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index ee8706bc9..a1db06b0b 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -380,8 +380,7 @@ collect_all_directories (gpointer key,
 static void
 filtering_changed_callback (gpointer callback_data)
 {
-    GList *dirs, *l;
-    NautilusDirectory *directory;
+    g_autolist (NautilusDirectory) dirs = NULL;
 
     g_assert (callback_data == NULL);
 
@@ -391,13 +390,14 @@ filtering_changed_callback (gpointer callback_data)
     /* Preference about which items to show has changed, so we
      * can't trust any of our precomputed directory counts.
      */
-    for (l = dirs; l != NULL; l = l->next)
+    for (GList *l = dirs; l != NULL; l = l->next)
     {
+        NautilusDirectory *directory;
+
         directory = NAUTILUS_DIRECTORY (l->data);
+
         nautilus_directory_invalidate_count_and_mime_list (directory);
     }
-
-    nautilus_directory_list_unref (dirs);
 }
 
 void


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