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



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

    libtracker-miner: Avoid possible race condition when cancelling extraction
    
    Fixes NB#262992. 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 |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index d962a8d..23716f2 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2057,13 +2057,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, user_data);
-	return FALSE;
-}
-
 static SendAndSpliceData *
 send_and_splice_data_new (GInputStream                     *unix_input_stream,
                           GInputStream                     *buffered_input_stream,
@@ -2486,7 +2479,7 @@ process_file_cb (GObject      *object,
 		/* For directories, don't request embedded metadata extraction.
 		 * We setup an idle so that we keep the previous behavior. */
 		g_debug ("Avoiding embedded metadata request for directory '%s'", uri);
-		g_idle_add (extractor_skip_embedded_metadata_idle, data);
+		extractor_get_embedded_metadata_cb (NULL, NULL, NULL, user_data);
 	}
 
 	g_object_unref (file_info);



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