[liboobs] Fix crash when updating with old OobsObjects destroyed



commit fb3621e46cd7e48a3342dbfac64cbc5fc91be570
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Sat Feb 13 00:24:57 2010 +0100

    Fix crash when updating with old OobsObjects destroyed
    
    Destroyed OobsObjects didn't remove the D-Bus filter function, which was called when *any* object was updated. Since the reference was now invalid, we got a crash. This is likely to have een revealed by recent changes that allow OobsObjects to be actually destroyed after an update has made them obsolete.

 oobs/oobs-object.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/oobs/oobs-object.c b/oobs/oobs-object.c
index 696ce06..34273b7 100644
--- a/oobs/oobs-object.c
+++ b/oobs/oobs-object.c
@@ -87,6 +87,10 @@ static void oobs_object_get_property (GObject       *object,
 				      GValue        *value,
 				      GParamSpec    *pspec);
 
+static DBusHandlerResult changed_signal_filter (DBusConnection *connection,
+                                                DBusMessage    *message,
+                                                void           *user_data);
+
 static void connect_object_to_session (OobsObject *object);
 
 enum
@@ -179,6 +183,7 @@ oobs_object_finalize (GObject *object)
 {
   OobsObject *obj;
   OobsObjectPrivate *priv;
+  DBusConnection *connection;
 
   g_return_if_fail (OOBS_IS_OBJECT (object));
 
@@ -190,6 +195,9 @@ oobs_object_finalize (GObject *object)
   g_list_foreach (priv->pending_calls, (GFunc) dbus_pending_call_unref, NULL);
   g_list_free (priv->pending_calls);
 
+  connection = _oobs_session_get_connection_bus (priv->session);
+  dbus_connection_remove_filter (connection, changed_signal_filter, object);
+
   g_object_unref (priv->session);
   g_free (priv->remote_object);
   g_free (priv->path);



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