From fa9b295c0e809d146f2c118c5afd61c594047626 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 23 Apr 2013 11:39:34 +0200 Subject: [PATCH] core: close private D-BUS connections on disconnect (bgo #698640) Private connections need to be closed in addition to being unrefed. https://bugzilla.gnome.org/show_bug.cgi?id=698640 --- src/nm-dbus-manager.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/nm-dbus-manager.c b/src/nm-dbus-manager.c index 4953193e09..c8a2010fac 100644 --- a/src/nm-dbus-manager.c +++ b/src/nm-dbus-manager.c @@ -122,7 +122,6 @@ private_server_message_filter (DBusConnection *conn, s->detail, dbus_connection_get_g_connection (conn)); - dbus_connection_close (conn); g_hash_table_remove (s->connections, conn); /* Let dbus-glib process the message too */ @@ -167,6 +166,14 @@ private_server_new_connection (DBusServer *server, dbus_connection_get_g_connection (conn)); } +static void +private_server_dbus_connection_destroy (DBusConnection *conn) +{ + if (dbus_connection_get_is_connected (conn)) + dbus_connection_close (conn); + dbus_connection_unref (conn); +} + static PrivateServer * private_server_new (const char *path, const char *tag, @@ -198,7 +205,7 @@ private_server_new (const char *path, dbus_server_set_new_connection_function (s->server, private_server_new_connection, s, NULL); s->connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, - (GDestroyNotify) dbus_connection_unref, + (GDestroyNotify) private_server_dbus_connection_destroy, g_free); s->manager = manager; s->tag = g_strdup (tag);