tracker r2374 - in trunk: . src/tracker-indexer



Author: carlosg
Date: Wed Oct 15 09:09:27 2008
New Revision: 2374
URL: http://svn.gnome.org/viewvc/tracker?rev=2374&view=rev

Log:
2008-10-15  Carlos Garnacho  <carlos imendio com>

        * src/tracker-indexer/tracker-metadata-utils.c
        (process_context_child_watch_cb): Inconditionally destroy here the
        context, even if it's not the metadata one. Avoids leaks when for some
        reason the metadata extractor dies immediately.
        (get_file_thumbnail) (get_file_content_by_filter): Don't destroy the
        context here.
        (get_file_thumbnail): Do not send non-utf8 over DBus.
        (get_file_thumbnail_queue_cb): Plug a leak.
        (metadata_query_file): Ensure the context is destroyed if any attempt
        to write fails.
        (metadata_query_file): Removed unnecessary g_free()


Modified:
   trunk/ChangeLog
   trunk/src/tracker-indexer/tracker-metadata-utils.c

Modified: trunk/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-metadata-utils.c	(original)
+++ trunk/src/tracker-indexer/tracker-metadata-utils.c	Wed Oct 15 09:09:27 2008
@@ -90,15 +90,19 @@
 				gint	 status,
 				gpointer user_data)
 {
-	g_debug ("Process '%d' exited with code: %d->'%s'",
+	ProcessContext *context;
+
+	g_debug ("Process '%d' exited with code %d",
 		 pid,
-		 status,
-		 g_strerror (status));
+		 status);
 
-	if (user_data == metadata_context) {
-		process_context_destroy (metadata_context);
+	context = (ProcessContext *) user_data;
+
+	if (context == metadata_context) {
 		metadata_context = NULL;
 	}
+
+	process_context_destroy (context);
 }
 
 static ProcessContext *
@@ -205,7 +209,6 @@
 
 	metadata_context = process_context_create (argv,
 						   metadata_read_cb);
-
 	if (!metadata_context) {
 		return FALSE;
 	}
@@ -233,7 +236,6 @@
 	utf_path = g_filename_from_utf8 (path, -1, NULL, NULL, NULL);
 
 	if (!utf_path) {
-		g_free (utf_path);
 		return NULL;
 	}
 
@@ -264,6 +266,8 @@
 
 		if (status == G_IO_STATUS_ERROR) {
 			/* No point in trying again */
+			process_context_destroy (metadata_context);
+			metadata_context = NULL;
 			g_free (str);
 			return NULL;
 		}
@@ -629,6 +633,11 @@
 	dbus_g_proxy_end_call (proxy, call, &error,
 			       G_TYPE_UINT, &handle,
 			       G_TYPE_INVALID);
+
+	if (error) {
+		g_warning (error->message);
+		g_error_free (error);
+	}
 }
 
 #endif /* HAVE_HILDON_THUMBNAIL */
@@ -647,7 +656,13 @@
 	}
 
 	if (count < 51) {
-		batch[count++] = g_strdup (path);
+		gchar *utf_path;
+
+		utf_path = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
+
+		if (utf_path) {
+			batch[count++] = utf_path;
+		}
 	}
 
 	if (count == 51) {
@@ -700,8 +715,6 @@
 	g_free (argv[2]);
 	g_free (argv[3]);
 
-	process_context_destroy (context);
-
 	if (!thumbnail->str || !*thumbnail->str) {
 		g_string_free (thumbnail, TRUE);
 		return;
@@ -767,8 +780,6 @@
 	 */
 	g_main_loop_run (context->data_incoming_loop);
 
-	process_context_destroy (context);
-
 	return g_string_free (text, FALSE);
 }
 



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