Skip to content

dbus: prefer closures2#3142

Open
flaviut wants to merge 1 commit intoblueman-project:mainfrom
flaviut:dbus-prefer-closures2
Open

dbus: prefer closures2#3142
flaviut wants to merge 1 commit intoblueman-project:mainfrom
flaviut:dbus-prefer-closures2

Conversation

@flaviut
Copy link

@flaviut flaviut commented Mar 3, 2026

register_object_with_closures is deprecated in favor of register_object_with_closures2, since the original leaks memory or otherwise requires some extra work to avoid leaking memory, I don't fully understand:

Deprecated in favour of g_dbus_connection_register_object_with_closures2(), which has more binding-friendly reference counting semantics.

Keep getattr fallback so older GLib runtimes still work.

Fixes #3101

Testing:

I've been running this patch locally for 8 days with no issues. I've also got this minimal reproducer, which quickly shows the fix works:

closure_leak_comparison

register_object_with_closures is deprecated in favor of
register_object_with_closures2, since the original leaks memory or
otherwise requires some extra work to avoid leaking memory, I don't
fully understand:

> Deprecated in favour of g_dbus_connection_register_object_with_closures2(), which has more binding-friendly reference counting semantics.

Keep getattr fallback so older GLib runtimes still work.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2026

@infirit
Copy link
Contributor

infirit commented Mar 3, 2026

There is more information in the commit that introduced version 2. Preferably id like pygobject to add an override for this so it just works transparently for all projects.

But I think having this in blueman is OK as it's simple enough. Ill post some links to relevant discussion later.

Commit adding v2 with context: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4431
Reverted PR https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak: 1.5GB/week

2 participants