gdbusconnection: Add a comment explaining why an invocation is ‘leaked’

It’s not leaked, it’s transferred forwards to the eventual
`g_dbus_method_invocation_return_*()` call.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3559
This commit is contained in:
Philip Withnall 2024-12-10 15:59:04 +00:00
parent 4641535596
commit 25cbde1e16
No known key found for this signature in database
GPG Key ID: C5C42CFB268637CA

View File

@ -5951,6 +5951,11 @@ register_with_closures_on_method_call (GDBusConnection *connection,
g_value_set_variant (&params[5], parameters);
g_value_init (&params[6], G_TYPE_DBUS_METHOD_INVOCATION);
/* NOTE: This is deliberately *not* g_value_take_object(). A reference to
* `invocation` is transferred in to this function, and it needs to be
* transferred onwards to the `g_dbus_method_invocation_return_*()` method
* call which must eventually happen (either in the closure function, or in
* a delayed consequence from it). Changing this will break API. */
g_value_set_object (&params[6], invocation);
g_closure_invoke (data->method_call_closure, NULL, G_N_ELEMENTS (params), params, NULL);