Philip Withnall 14a756ae97
gdbusconnection: Add g_dbus_connection_register_object_with_closures2() API
This replaces `g_dbus_connection_register_object_with_closures()`, and
becomes the new binding-friendly version of
`g_dbus_connection_register_object()`.

The problem with `g_dbus_connection_register_object_with_closures()` is
that the `method_call_closure` kept the reference counting semantics of
`GDBusInterfaceMethodCallFunc`, in that the `invocation` argument was
`(transfer full)`, even though it was wrapped in a `GClosure`. This
couldn’t be described in introspection annotations, so the
`GDBusMethodInvocation` was being leaked by bindings. Some bindings
added workarounds to fix the leak at our direction (see
https://gitlab.gnome.org/GNOME/glib/-/issues/2600#note_1385050), which
meant we could no longer change the reference counting behaviour without
breaking those bindings (see #3559).

So let’s start afresh with
`g_dbus_connection_register_object_with_closures2()`, with correctly
defined reference counting semantics (the `GDBusMethodInvocation` is
`(transfer none)`) from the start.

Unfortunately we can’t add a `(rename-to)` annotation to the new API, as
that would effectively be an API break for existing binding code which
uses the old API via that rename.

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

Fixes: #3560
2025-02-11 14:08:05 +00:00
..
2024-09-27 11:41:33 +08:00
2024-12-08 22:15:03 +01:00
2024-09-27 21:45:33 +02:00
2023-01-27 11:58:56 +03:00
2020-11-17 15:50:07 +00:00