[tracker] libtracker-miner: Avoid possible race condition when cancelling extraction



commit 9e56039324ad9eb084a9edb8f98b72fc44578418
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 3 16:21:29 2011 +0200

    libtracker-miner: Avoid possible race condition when cancelling extraction
    
    Operations for files that aren't sent to the extractor were instead finished
    an idle function, which could lead to double frees if the task was cancelled
    right in between (one resulting from cancellable::cancel, the other when
    dispatching the idle function).
    
    So, instead, don't do that in an idle at all, there is no reason why
    we can't call tracker_miner_fs_file_notify() right away.

 src/miners/fs/tracker-miner-files.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 8a09454..043f54d 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2067,13 +2067,6 @@ extractor_get_embedded_metadata_cancel (GCancellable    *cancellable,
 	g_error_free (error);
 }
 
-static gboolean
-extractor_skip_embedded_metadata_idle (gpointer user_data)
-{
-	extractor_get_embedded_metadata_cb (NULL, NULL, NULL, NULL, user_data);
-	return FALSE;
-}
-
 static SendAndSpliceData *
 send_and_splice_data_new (GInputStream                     *unix_input_stream,
                           GInputStream                     *buffered_input_stream,
@@ -2506,10 +2499,9 @@ process_file_cb (GObject      *object,
 		/* Next step, if handled by the extractor, get embedded metadata */
 		extractor_get_embedded_metadata (data, uri, mime_type);
 	} else {
-		/* Otherwise, don't request embedded metadata extraction.
-		 * We setup an idle so that we keep the previous behavior. */
+		/* Otherwise, don't request embedded metadata extraction. */
 		g_debug ("Avoiding embedded metadata request for uri '%s'", uri);
-		g_idle_add (extractor_skip_embedded_metadata_idle, data);
+		extractor_get_embedded_metadata_cb (NULL, NULL, NULL, NULL, user_data);
 	}
 
 	g_object_unref (file_info);



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