diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-02-25 17:08:59 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-07-28 18:23:25 +0100 |
commit | 6310774e98a51a4a2ec550e39ba3e1a58f2d0caa (patch) | |
tree | 8dcc64c5b11ecd817838cb3418ab72bc30b2d90d | |
parent | 0688924ed21a7a0d975b9e01c39d059a18738b86 (diff) | |
download | dbus-6310774e98a51a4a2ec550e39ba3e1a58f2d0caa.tar.gz |
Comment some places where it's OK to unref a message despite holding locks
In general, dbus_message_unref should be avoided while holding locks,
because it can invoke arbitrary user callbacks (via attached data, or
via DBusCounter).
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34393
-rw-r--r-- | dbus/dbus-connection.c | 2 | ||||
-rw-r--r-- | dbus/dbus-pending-call.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index fad69c73..a917f9a9 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -4701,6 +4701,8 @@ dbus_connection_dispatch (DBusConnection *connection) if (preallocated == NULL) { + /* It's OK that this is finalized, because it hasn't been seen by + * anything that could attach user callbacks */ dbus_message_unref (reply); result = DBUS_HANDLER_RESULT_NEED_MEMORY; _dbus_verbose ("no memory for error send in dispatch\n"); diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c index cfb2bafe..f9613195 100644 --- a/dbus/dbus-pending-call.c +++ b/dbus/dbus-pending-call.c @@ -353,6 +353,8 @@ _dbus_pending_call_set_timeout_error_unlocked (DBusPendingCall *pending, reply_link = _dbus_list_alloc_link (reply); if (reply_link == NULL) { + /* it's OK to unref this, nothing that could have attached a callback + * has ever seen it */ dbus_message_unref (reply); return FALSE; } |