[tracker-miners/wip/carlosg/hidden-file-moves: 1/2] libtracker-miner: Use separate GFileInfo for dest file in move operations




commit a6d6abcdd9955548bdb394a422aa84d4d89d4e0f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Sep 18 20:26:05 2021 +0200

    libtracker-miner: Use separate GFileInfo for dest file in move operations
    
    In move operations, using the same GFileInfo breaks further down if the
    information there is to be guessed out of the filename differs (i.e.
    file moving from hidden to non-hidden, or the other way around), this
    may result in file events not being properly sent for this kind of changes.
    
    Generate a distinct GFileInfo for these situations, so the checks on the
    dest file come out correct, and result in the file being properly guessed
    as created/deleted from the Tracker perspective.
    
    Fixes: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/196

 src/libtracker-miner/tracker-file-notifier.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index feba7152d..8422c7f4d 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -1161,7 +1161,7 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
                /* else, file, do nothing */
        } else {
                gboolean should_process, should_process_other;
-               GFileInfo *file_info;
+               GFileInfo *file_info, *other_file_info;
                GFile *check_file;
 
                if (is_directory) {
@@ -1171,6 +1171,7 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
                }
 
                file_info = create_shallow_file_info (file, is_directory);
+               other_file_info = create_shallow_file_info (other_file, is_directory);
 
                /* If the (parent) directory is in
                 * the filesystem, file is stored
@@ -1178,9 +1179,10 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
                should_process = tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
                                                                          file, file_info);
                should_process_other = tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
-                                                                               other_file, file_info);
+                                                                               other_file, other_file_info);
                g_object_unref (check_file);
                g_object_unref (file_info);
+               g_object_unref (other_file_info);
 
                /* Ref those so they are safe to use after signal emission */
                g_object_ref (file);


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