From 88ad0dab214799f17f0ddc463d10f44c00587dbf Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 28 Apr 2017 12:05:42 +0100 Subject: [PATCH] gdbusconnection: Add some comments about object ownership Some annotations I made while trying to debug bug #781847. They introduce no behavioural changes. Signed-off-by: Philip Withnall --- gio/gdbusconnection.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 7c88a4eb3..4a4f4031b 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -1758,7 +1758,7 @@ send_message_data_free (SendMessageData *data) /* ---------------------------------------------------------------------------------------------------- */ -/* can be called from any thread with lock held */ +/* can be called from any thread with lock held; @task is (transfer full) */ static void send_message_with_reply_cleanup (GTask *task, gboolean remove) { @@ -1794,7 +1794,7 @@ send_message_with_reply_cleanup (GTask *task, gboolean remove) /* ---------------------------------------------------------------------------------------------------- */ -/* Called from GDBus worker thread with lock held */ +/* Called from GDBus worker thread with lock held; @task is (transfer full). */ static void send_message_data_deliver_reply_unlocked (GTask *task, GDBusMessage *reply) @@ -1839,7 +1839,7 @@ send_message_data_deliver_error (GTask *task, /* ---------------------------------------------------------------------------------------------------- */ -/* Called from a user thread, lock is not held */ +/* Called from a user thread, lock is not held; @task is (transfer full) */ static gboolean send_message_with_reply_cancelled_idle_cb (gpointer user_data) { @@ -1869,7 +1869,7 @@ send_message_with_reply_cancelled_cb (GCancellable *cancellable, /* ---------------------------------------------------------------------------------------------------- */ -/* Called from a user thread, lock is not held */ +/* Called from a user thread, lock is not held; @task is (transfer full) */ static gboolean send_message_with_reply_timeout_cb (gpointer user_data) { @@ -1942,7 +1942,7 @@ g_dbus_connection_send_message_with_reply_unlocked (GDBusConnection *connect g_hash_table_insert (connection->map_method_serial_to_task, GUINT_TO_POINTER (*out_serial), - task); + g_steal_pointer (&task)); } /** @@ -2283,6 +2283,7 @@ on_worker_message_received (GDBusWorker *worker, GUINT_TO_POINTER (reply_serial)); if (task != NULL) { + /* This removes @task from @map_method_serial_to_task. */ //g_debug ("delivering reply/error for serial %d for %p", reply_serial, connection); send_message_data_deliver_reply_unlocked (task, message); }