[tracker-miners/wip/carlosg/leak-fixes: 4/5] libtracker-miner: Fix accounting of TrackerFileSystem




commit 6476a295e0624e36fb942b0b3cd6b5c0226caa38
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Aug 5 12:08:44 2020 +0200

    libtracker-miner: Fix accounting of TrackerFileSystem
    
    After dealing with changes and emitting events on files, the
    TrackerFileNotifier intends to only keep the directory skeleton in the
    TrackerFileSystem, and forget about regular files (until they might be
    needed again).
    
    The code here fared well when we used to query and crawl folders one
    by one, as it was meant to run once per folder. We however changed to
    querying per index-root and crawling per folder, so this is now forgetting
    about files in a random directory of the index root and leaving everything
    else.
    
    Forget about the files from the root directory, this restores the neat
    barebones TrackerFileSystem structure after indexing.

 src/libtracker-miner/tracker-file-notifier.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index eb745d265..8786f35b1 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -556,25 +556,18 @@ finish_current_directory (TrackerFileNotifier *notifier,
                           gboolean             interrupted)
 {
        TrackerFileNotifierPrivate *priv;
-       GFile *directory;
 
        priv = tracker_file_notifier_get_instance_private (notifier);
-       directory = priv->current_index_root->current_dir;
-       priv->current_index_root->current_dir = NULL;
-       priv->current_index_root->current_dir_content_filtered = FALSE;
 
-       if (directory) {
-               /* If crawling was interrupted, we take all collected info as invalid.
-                * Otherwise we dispose regular files here, only directories are
-                * cached once crawling has completed.
-                */
-               tracker_file_system_forget_files (priv->file_system,
-                                                 directory,
-                                                 interrupted ?
-                                                 G_FILE_TYPE_UNKNOWN :
-                                                 G_FILE_TYPE_REGULAR);
-               g_object_unref (directory);
-       }
+       /* If crawling was interrupted, we take all collected info as invalid.
+        * Otherwise we dispose regular files here, only directories are
+        * cached once crawling has completed.
+        */
+       tracker_file_system_forget_files (priv->file_system,
+                                         priv->current_index_root->root,
+                                         interrupted ?
+                                         G_FILE_TYPE_UNKNOWN :
+                                         G_FILE_TYPE_REGULAR);
 
        if (interrupted || !crawl_directory_in_current_root (notifier)) {
                /* No more directories left to be crawled in the current


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