From e03d3c41cf912eb695a643415397c171d2978a4c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 20 Jan 2011 15:48:07 +0000 Subject: [PATCH] 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 --- bus/test.c | 4 ---- dbus/dbus-connection.c | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) 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 6779b6a..c5e8fc2 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -3323,6 +3323,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); @@ -3335,6 +3336,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; } -- 1.7.2.3