From: Simon McVittie Date: Thu, 20 Jan 2011 15:48:07 +0000 (+0000) Subject: DBusConnection: ref the connection in the timeout handler X-Git-Tag: dbus-1.5.6~104 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8ccef11bbbc13b6ab74daaa76d9a9463f99b009;p=platform%2Fupstream%2Fdbus.git 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 --- diff --git a/bus/test.c b/bus/test.c index 6efad6e..95c7cfb 100644 --- a/bus/test.c +++ b/bus/test.c @@ -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 diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 1a7079d..9ec85c0 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -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; }