diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2006-07-07 19:42:56 +0000 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2006-07-07 19:42:56 +0000 |
commit | 50f88a0322cee156a5d9737f0987e57b964606cc (patch) | |
tree | 6db31d41f4bbd27167e03654577db84cf36145ad /dbus | |
parent | 84e55065ea9bef999f068de65c3eed0c9cc42fac (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')
-rw-r--r-- | dbus/dbus-bus.c | 23 | ||||
-rw-r--r-- | dbus/dbus-bus.h | 2 | ||||
-rw-r--r-- | dbus/dbus-connection.c | 30 | ||||
-rw-r--r-- | dbus/dbus-connection.h | 1 |
4 files changed, 36 insertions, 20 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); diff --git a/dbus/dbus-bus.h b/dbus/dbus-bus.h index 2329e138..c47af153 100644 --- a/dbus/dbus-bus.h +++ b/dbus/dbus-bus.h @@ -68,6 +68,8 @@ void dbus_bus_remove_match (DBusConnection *connection, const char *rule, DBusError *error); +void _dbus_bus_check_connection_and_unref (DBusConnection *connection); + DBUS_END_DECLS #endif /* DBUS_BUS_H */ diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 4a2d087b..9f6e6260 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -1947,18 +1947,6 @@ dbus_connection_close (DBusConnection *connection) _dbus_connection_update_dispatch_status_and_unlock (connection, status); } -/** Alias for dbus_connection_close(). This method is DEPRECATED and will be - * removed for 1.0. Change your code to use dbus_connection_close() instead. - * - * @param connection the connection. - * @deprecated - */ -void -dbus_connection_disconnect (DBusConnection *connection) -{ - dbus_connection_close (connection); -} - static dbus_bool_t _dbus_connection_get_is_connected_unlocked (DBusConnection *connection) { @@ -3780,15 +3768,21 @@ dbus_connection_dispatch (DBusConnection *connection) { _dbus_verbose (" ... done dispatching in %s\n", _DBUS_FUNCTION_NAME); - if (connection->exit_on_disconnect && - dbus_message_is_signal (message, + if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected")) { - _dbus_verbose ("Exiting on Disconnected signal\n"); - CONNECTION_UNLOCK (connection); - _dbus_exit (1); - _dbus_assert_not_reached ("Call to exit() returned"); + int i; + + + _dbus_bus_check_connection_and_unref (connection); + if (connection->exit_on_disconnect) + { + _dbus_verbose ("Exiting on Disconnected signal\n"); + CONNECTION_UNLOCK (connection); + _dbus_exit (1); + _dbus_assert_not_reached ("Call to exit() returned"); + } } _dbus_list_free_link (message_link); diff --git a/dbus/dbus-connection.h b/dbus/dbus-connection.h index 9784f260..983f327e 100644 --- a/dbus/dbus-connection.h +++ b/dbus/dbus-connection.h @@ -93,7 +93,6 @@ DBusConnection* dbus_connection_open_private (const char DBusError *error); DBusConnection* dbus_connection_ref (DBusConnection *connection); void dbus_connection_unref (DBusConnection *connection); -void dbus_connection_close (DBusConnection *connection); void dbus_connection_disconnect (DBusConnection *connection); dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection); dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection); |