[tracker/tracker-0.8] Fixes NB#180679: Make sure DBusGProxy is destroyed when destroying miner



commit 7ceb0166bd044a591128cf5c1a5a2a86ce9bc432
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Wed Jul 21 14:24:59 2010 +0200

    Fixes NB#180679: Make sure DBusGProxy is destroyed when destroying miner
    
      * It's quite a race condition, but could happen that the miner object
        gets fully disposed, but the DBusGProxy was still alive as there was
        an extra reference of it. In this case, if receiving a new message
        in the filter for NameOwnerChanged, we were calling g_object_get_qdata()
        on an already destroyed GObject.

 src/libtracker-miner/tracker-dbus.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-dbus.c b/src/libtracker-miner/tracker-dbus.c
index 1a3b7dd..be6e32b 100644
--- a/src/libtracker-miner/tracker-dbus.c
+++ b/src/libtracker-miner/tracker-dbus.c
@@ -206,12 +206,14 @@ dbus_data_create (TrackerMiner          *miner,
 
 	/* Now we're successfully connected and registered, create the data */
 	data = g_slice_new0 (DBusData);
+	/* Connection object is a shared one, so we need to keep our own
+	 * reference to it */
 	data->connection = dbus_g_connection_ref (connection);
-	data->gproxy = g_object_ref (gproxy);
-        data->name_monitors = g_hash_table_new_full (g_str_hash,
-                                                     g_str_equal,
-                                                     (GDestroyNotify) g_free,
-                                                     NULL);
+	data->gproxy = gproxy;
+	data->name_monitors = g_hash_table_new_full (g_str_hash,
+	                                             g_str_equal,
+	                                             (GDestroyNotify) g_free,
+	                                             NULL);
 
 	return data;
 }



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