summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-10-18 22:43:31 +0200
committerCarlos Garnacho <carlosg@gnome.org>2017-10-21 22:53:36 +0200
commit89f4f6ec76dee15e525151feed0303d2732ee371 (patch)
treecf55223639ef1038da30b771dd58f5f39c94d57f
parent466ac81147a7194f0d7a5607cc56ebe38203fc53 (diff)
downloadtracker-89f4f6ec76dee15e525151feed0303d2732ee371.tar.gz
libtracker-miner: Intern GFiles on TrackerMonitor::item-moved
The assumption is that TrackerFileNotifier emits files that are currently interned in the TrackerFileSystem. This event handler broke the assumption in a couple of places.
-rw-r--r--src/libtracker-miner/tracker-file-notifier.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 515e5b92e..ba225e89d 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -1312,11 +1312,11 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
tracker_monitor_remove_recursively (priv->monitor, file);
/* If should recurse, crawl other_file, as content is "new" */
- file = tracker_file_system_get_file (priv->file_system,
- other_file,
- G_FILE_TYPE_DIRECTORY,
- NULL);
- notifier_queue_file (notifier, file, flags);
+ other_file = tracker_file_system_get_file (priv->file_system,
+ other_file,
+ G_FILE_TYPE_DIRECTORY,
+ NULL);
+ notifier_queue_file (notifier, other_file, flags);
crawl_directories_start (notifier);
}
/* else, file, do nothing */
@@ -1343,6 +1343,17 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
file_type);
g_object_unref (check_file);
+ file = tracker_file_system_get_file (priv->file_system,
+ file, file_type,
+ NULL);
+ other_file = tracker_file_system_get_file (priv->file_system,
+ other_file, file_type,
+ NULL);
+
+ /* Ref those so they are safe to use after signal emission */
+ g_object_ref (file);
+ g_object_ref (other_file);
+
if (!source_stored) {
/* Destination location should be indexed as if new */
/* Remove monitors if any */
@@ -1363,10 +1374,6 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
g_signal_emit (notifier, signals[FILE_CREATED], 0, other_file);
} else if (is_directory) {
/* Crawl dest directory */
- other_file = tracker_file_system_get_file (priv->file_system,
- other_file,
- G_FILE_TYPE_DIRECTORY,
- NULL);
notifier_queue_file (notifier, other_file, flags);
crawl_directories_start (notifier);
}
@@ -1403,17 +1410,24 @@ monitor_item_moved_cb (TrackerMonitor *monitor,
*/
} else if (!source_is_recursive && dest_is_recursive) {
/* crawl the folder */
- file = tracker_file_system_get_file (priv->file_system,
- other_file,
- G_FILE_TYPE_DIRECTORY,
- NULL);
- notifier_queue_file (notifier, file, flags);
+ notifier_queue_file (notifier, other_file, flags);
crawl_directories_start (notifier);
}
}
g_signal_emit (notifier, signals[FILE_MOVED], 0, file, other_file);
}
+
+ tracker_file_system_forget_files (priv->file_system, file,
+ G_FILE_TYPE_REGULAR);
+
+ if (!is_directory) {
+ tracker_file_system_forget_files (priv->file_system, other_file,
+ G_FILE_TYPE_REGULAR);
+ }
+
+ g_object_unref (other_file);
+ g_object_unref (file);
}
}