summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-bus.c
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2006-07-07 19:42:56 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2006-07-07 19:42:56 +0000
commit50f88a0322cee156a5d9737f0987e57b964606cc (patch)
tree6db31d41f4bbd27167e03654577db84cf36145ad /dbus/dbus-bus.c
parent84e55065ea9bef999f068de65c3eed0c9cc42fac (diff)
* dbus/dbus-connection.c (dbus_connection_close): removed deprecated
function (dbus_connection_dispatch): On disconnect unref any shared connections * dbus/dbus-bus.c (_dbus_bus_check_connection_and_unref): new function for cleaning up shared connections on disconnect (internal_bus_get): get a hard refrence to shared connections when they are created * doc/TODO: Remove items which are no longer relevent or have been fixed Split 1.0 todo items with a 0.90 freeze todo list
Diffstat (limited to 'dbus/dbus-bus.c')
-rw-r--r--dbus/dbus-bus.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c
index 0b8c9c4f..273fe5fe 100644
--- a/dbus/dbus-bus.c
+++ b/dbus/dbus-bus.c
@@ -302,6 +302,23 @@ ensure_bus_data (DBusConnection *connection)
return bd;
}
+/* internal function that checks to see if this
+ is a shared bus connection and if it is unref it */
+void
+_dbus_bus_check_connection_and_unref (DBusConnection *connection)
+{
+ if (bus_connections[DBUS_BUS_SYSTEM] == connection)
+ {
+ bus_connections[DBUS_BUS_SYSTEM] = NULL;
+ dbus_connection_unref (connection);
+ }
+ else if (bus_connections[DBUS_BUS_SESSION] == connection)
+ {
+ bus_connections[DBUS_BUS_SESSION] = NULL;
+ dbus_connection_unref (connection);
+ }
+}
+
static DBusConnection *
internal_bus_get (DBusBusType type,
DBusError *error, dbus_bool_t private)
@@ -385,7 +402,11 @@ internal_bus_get (DBusBusType type,
}
if (!private)
- bus_connections[type] = connection;
+ {
+ /* get a hard ref to the connection */
+ bus_connections[type] = connection;
+ dbus_connection_ref (bus_connections[type]);
+ }
bd = ensure_bus_data (connection);
_dbus_assert (bd != NULL);