[tracker] tracker-store: Fixes NB#180803, Busy-handling race condition



commit 0c9764726cedaab9d168dedbe8ae8e50eb892d83
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Aug 2 17:51:26 2010 +0200

    tracker-store: Fixes NB#180803, Busy-handling race condition

 src/tracker-store/tracker-dbus.c |   41 ++++++++++++++++---------------------
 src/tracker-store/tracker-dbus.h |    1 +
 src/tracker-store/tracker-main.c |    4 +++
 3 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/src/tracker-store/tracker-dbus.c b/src/tracker-store/tracker-dbus.c
index 59377a7..d2f2e01 100644
--- a/src/tracker-store/tracker-dbus.c
+++ b/src/tracker-store/tracker-dbus.c
@@ -100,11 +100,27 @@ dbus_register_object (DBusGConnection       *lconnection,
 	dbus_g_connection_register_g_object (lconnection, path, object);
 }
 
-static gboolean
-dbus_register_names (void)
+gboolean
+tracker_dbus_register_names (void)
+{
+	/* Register the service name for org.freedesktop.Tracker */
+	if (!dbus_register_service (gproxy, TRACKER_STATISTICS_SERVICE)) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+gboolean
+tracker_dbus_init (void)
 {
 	GError *error = NULL;
 
+	/* Don't reinitialize */
+	if (objects) {
+		return TRUE;
+	}
+
 	if (connection) {
 		g_critical ("The DBusGConnection is already set, have we already initialized?");
 		return FALSE;
@@ -132,27 +148,6 @@ dbus_register_names (void)
 	                                    DBUS_PATH_DBUS,
 	                                    DBUS_INTERFACE_DBUS);
 
-	/* Register the service name for org.freedesktop.Tracker */
-	if (!dbus_register_service (gproxy, TRACKER_STATISTICS_SERVICE)) {
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-gboolean
-tracker_dbus_init (void)
-{
-	/* Don't reinitialize */
-	if (objects) {
-		return TRUE;
-	}
-
-	/* Register names and get proxy/connection details */
-	if (!dbus_register_names ()) {
-		return FALSE;
-	}
-
 	dbus_g_proxy_add_signal (gproxy, "NameOwnerChanged",
 	                         G_TYPE_STRING,
 	                         G_TYPE_STRING,
diff --git a/src/tracker-store/tracker-dbus.h b/src/tracker-store/tracker-dbus.h
index 15ba374..fb0d430 100644
--- a/src/tracker-store/tracker-dbus.h
+++ b/src/tracker-store/tracker-dbus.h
@@ -34,6 +34,7 @@ void            tracker_dbus_shutdown                (void);
 gboolean        tracker_dbus_register_objects        (void);
 GObject        *tracker_dbus_get_object              (GType type);
 TrackerStatus  *tracker_dbus_register_notifier       (void);
+gboolean        tracker_dbus_register_names          (void);
 
 G_END_DECLS
 
diff --git a/src/tracker-store/tracker-main.c b/src/tracker-store/tracker-main.c
index fb8ff09..ffebfc9 100644
--- a/src/tracker-store/tracker-main.c
+++ b/src/tracker-store/tracker-main.c
@@ -453,6 +453,10 @@ main (gint argc, gchar *argv[])
 		return EXIT_FAILURE;
 	}
 
+	if (!tracker_dbus_register_names ()) {
+		return EXIT_FAILURE;
+	}
+
 	chunk_size_mb = tracker_db_config_get_journal_chunk_size (db_config);
 	chunk_size = (gsize) ((gsize) chunk_size_mb * (gsize) 1024 * (gsize) 1024);
 	rotate_to = tracker_db_config_get_journal_rotate_destination (db_config);



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