[tracker] libtracker-miner: Unparent children on TrackerFileSystem root dispose



commit 7d279178fc0045948ba7209b317f305926cf7c03
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Sep 8 13:38:03 2018 +0200

    libtracker-miner: Unparent children on TrackerFileSystem root dispose
    
    We unparented children on intermediate folders, but didn't handle the
    case of the root folder disappearing. Unparent the child nodes so
    they get correctly freed when the respective GFiles are disposed.

 src/libtracker-miner/tracker-file-system.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-system.c b/src/libtracker-miner/tracker-file-system.c
index 6c42e6a40..961da4714 100644
--- a/src/libtracker-miner/tracker-file-system.c
+++ b/src/libtracker-miner/tracker-file-system.c
@@ -464,10 +464,6 @@ reparent_child_nodes_to_parent (GNode *node)
        FileNodeData *node_data;
        GNode *child, *parent;
 
-       if (!node->parent) {
-               return;
-       }
-
        parent = node->parent;
        node_data = node->data;
        child = g_node_first_child (node);
@@ -489,8 +485,12 @@ reparent_child_nodes_to_parent (GNode *node)
                data->uri_prefix = uri_prefix;
 
                g_node_unlink (cur);
-               g_node_prepend (parent, cur);
+
+               if (parent)
+                       g_node_prepend (parent, cur);
        }
+
+       g_assert (!g_node_first_child (node));
 }
 
 static void


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