[tracker] Fixed a crash when doing CTRL+C where items were still on the queue



commit 3922922203f1f9360c2e7b8ceaf7d6cd0027d15c
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Jul 21 16:16:13 2009 +0200

    Fixed a crash when doing CTRL+C where items were still on the queue

 src/tracker-store/tracker-main.c  |    4 +++-
 src/tracker-store/tracker-store.c |   16 +++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index 68f0edc..9df489d 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -809,8 +809,11 @@ shutdown:
 	 */
 	g_message ("Shutdown started");
 
+	tracker_store_shutdown ();
+
 	g_timeout_add_full (G_PRIORITY_LOW, 5000, shutdown_timeout_cb, NULL, NULL);
 
+
 	g_message ("Cleaning up");
 
 	shutdown_databases ();
@@ -825,7 +828,6 @@ shutdown:
 	tracker_dbus_shutdown ();
 	tracker_data_manager_shutdown ();
 	tracker_turtle_shutdown ();
-	tracker_store_shutdown ();
 	tracker_thumbnailer_shutdown ();
 	tracker_log_shutdown ();
 
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index fd9ac90..90e50a4 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -38,6 +38,7 @@ typedef struct {
 	gboolean  batch_mode;
 	guint     batch_count;
 	GQueue   *queue;
+	guint     handler;
 } TrackerStorePrivate;
 
 typedef enum {
@@ -272,11 +273,8 @@ tracker_store_shutdown (void)
 	g_return_if_fail (private != NULL);
 
 	if (private->have_handler) {
-		g_debug ("Can't exit until store-queue is finished ...");
-		while (private->have_handler) {
-			g_main_context_iteration (NULL, TRUE);
-		}
-		g_debug ("Store-queue finished");
+		g_source_remove (private->handler);
+		private->have_handler = FALSE;
 	}
 
 	g_static_private_set (&private_key, NULL, NULL);
@@ -287,10 +285,10 @@ start_handler (TrackerStorePrivate *private)
 {
 	private->have_handler = TRUE;
 
-	g_idle_add_full (G_PRIORITY_LOW,
-	                 queue_idle_handler,
-	                 private,
-	                 queue_idle_destroy);
+	private->handler = g_idle_add_full (G_PRIORITY_LOW,
+	                                    queue_idle_handler,
+	                                    private,
+	                                    queue_idle_destroy);
 }
 
 void



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