daemon/dbus: dbus server cleanup issue fixed
authorAmarnath Valluri <amarnath.valluri@linux.intel.com>
Fri, 10 May 2013 12:04:35 +0000 (15:04 +0300)
committerAmarnath Valluri <amarnath.valluri@linux.intel.com>
Thu, 16 May 2013 11:28:13 +0000 (14:28 +0300)
src/daemon/dbus/gsignond-dbus-server.c

index 61d59ec..f1743ec 100644 (file)
@@ -58,6 +58,11 @@ G_DEFINE_TYPE (GSignondDbusServer, gsignond_dbus_server, G_TYPE_OBJECT)
 #define GSIGNOND_DBUS_SERVER_GET_PRIV(obj) \
     G_TYPE_INSTANCE_GET_PRIVATE ((obj), GSIGNOND_TYPE_DBUS_SERVER, GSignondDbusServerPrivate)
 
+static void _on_connection_closed (GDBusConnection *connection,
+                       gboolean         remote_peer_vanished,
+                       GError          *error,
+                       gpointer         user_data);
+
 static void
 _set_property (GObject *object,
         guint property_id,
@@ -104,11 +109,19 @@ _get_property (GObject *object,
 }
 
 static void
+_clear_connection (gpointer connection, gpointer value, gpointer userdata)
+{
+    (void) value;
+    g_signal_handlers_disconnect_by_func (connection, _on_connection_closed, userdata);
+}
+
+static void
 _dispose (GObject *object)
 {
     GSignondDbusServer *self = GSIGNOND_DBUS_SERVER (object);
 
     if (self->priv->auth_services) {
+        g_hash_table_foreach (self->priv->auth_services, _clear_connection, self);
         g_hash_table_unref (self->priv->auth_services);
         self->priv->auth_services = NULL;
     }