From 50f88a0322cee156a5d9737f0987e57b964606cc Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Fri, 7 Jul 2006 19:42:56 +0000 Subject: * 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 --- dbus/dbus-bus.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'dbus/dbus-bus.c') 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); -- cgit