diff options
author | Colin Walters <walters@verbum.org> | 2008-05-30 20:41:49 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2008-05-30 20:41:49 -0400 |
commit | ef41cd31100097636523088ec7f115e432366956 (patch) | |
tree | 63efd95c97f278d64cc14cd561eaf03a6a0950d9 /dbus | |
parent | 0e2a099b55a50b9b5a0f948e134b5a88e2924262 (diff) |
Bug 15635: Hold a reference during read/write dispatch (Scott James Remnant)
* dbus/dbus-connection.c (_dbus_connection_read_write_dispatch):
Reference the D-Bus connection during the function call since we
call other functions that may free the last reference and we
still expect to be able to check the connection after they return
to decide our own return value.
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-connection.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 1f427dd3..f2902ed4 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -3417,6 +3417,12 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection, { DBusDispatchStatus dstatus; dbus_bool_t no_progress_possible; + + /* Need to grab a ref here in case we're a private connection and + * the user drops the last ref in a handler we call; see bug + * https://bugs.freedesktop.org/show_bug.cgi?id=15635 + */ + dbus_connection_ref (connection); dstatus = dbus_connection_get_dispatch_status (connection); @@ -3456,7 +3462,11 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection, connection->disconnect_message_link == NULL; else no_progress_possible = _dbus_connection_get_is_connected_unlocked (connection); + CONNECTION_UNLOCK (connection); + + dbus_connection_unref (connection); + return !no_progress_possible; /* TRUE if we can make more progress */ } |