DBusConnection: ref the connection in the timeout handler

client_timeout_callback in bus/test.c refs the connection across the
timeout invocation, which looks suspiciously like a workaround. If we
make the timeout handler itself ref the connection, we won't need that,
and can simplify timeout handling drastically.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33342
Reviewed-by: Thiago Macieira <thiago@kde.org>
This commit is contained in:
Simon McVittie 2011-01-20 15:48:07 +00:00
parent c7ef3ead55
commit b8ccef11bb
2 changed files with 2 additions and 4 deletions

View file

@ -76,12 +76,8 @@ client_timeout_callback (DBusTimeout *timeout,
{
DBusConnection *connection = data;
dbus_connection_ref (connection);
/* can return FALSE on OOM but we just let it fire again later */
dbus_timeout_handle (timeout);
dbus_connection_unref (connection);
}
static dbus_bool_t

View file

@ -3276,6 +3276,7 @@ reply_handler_timeout (void *data)
DBusPendingCall *pending = data;
connection = _dbus_pending_call_get_connection_and_lock (pending);
_dbus_connection_ref_unlocked (connection);
_dbus_pending_call_queue_timeout_error_unlocked (pending,
connection);
@ -3288,6 +3289,7 @@ reply_handler_timeout (void *data)
/* Unlocks, and calls out to user code */
_dbus_connection_update_dispatch_status_and_unlock (connection, status);
dbus_connection_unref (connection);
return TRUE;
}