[tracker] Fix G_IS_OBJECT(file) errors.



commit 43fbbc193b2effe884bf4dc1698195ca41d3fac0
Author: Carlos Garnacho <carlos lanedo com>
Date:   Thu Feb 11 13:14:03 2010 +0100

    Fix G_IS_OBJECT(file) errors.
    
    the ProcessData was being found through g_file_equals(), but
    under a fast sequence of create/remove/create events for a file
    (as autofoo likes to do), there could be several ProcessData
    for different GFiles pointing to the same path. So
    process_data_find() now checks for pointer equality, since the
    GFile tracker_miner_fs_notify_file() is being called on should
    correspond to the GFile passed when emitting ::process-file.

 src/libtracker-miner/tracker-miner-fs.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 2fb7370..c98f75e 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -536,7 +536,13 @@ process_data_find (TrackerMinerFS *fs,
 	for (l = fs->private->processing_pool; l; l = l->next) {
 		ProcessData *data = l->data;
 
-		if (g_file_equal (data->file, file)) {
+		/* Different operations for the same file URI could be
+		 * piled up here, each being a different GFile object.
+		 * Miner implementations should really notify on the
+		 * same GFile object that's being passed, so we check for
+		 * pointer equality here, rather than doing path comparisons
+		 */
+		if (data->file == file) {
 			return data;
 		}
 	}
@@ -2436,9 +2442,10 @@ tracker_miner_fs_file_notify (TrackerMinerFS *fs,
 		g_critical ("%s has notified that file '%s' has been processed, "
 		            "but that file was not in the processing queue. "
 		            "This is an implementation error, please ensure that "
-		            "tracker_miner_fs_notify_file() is called on the right "
-		            "file and that the ::process-file signal didn't return "
-		            "FALSE for it", G_OBJECT_TYPE_NAME (fs), uri);
+		            "tracker_miner_fs_notify_file() is called on the same "
+			    "GFile that is passed in ::process-file, and that this"
+			    "signal didn't return FALSE for it",
+			    G_OBJECT_TYPE_NAME (fs), uri);
 		g_free (uri);
 
 		return;



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