From: Paul Menzel <noreply@github.com>
To: linux-bluetooth@vger.kernel.org
Subject: [bluez/bluez] 03f0f6: obexd: Reference count the phonebook back-end setu...
Date: Mon, 17 Aug 2026 09:21:05 -0700 [thread overview]
Message-ID: <bluez/bluez/push/refs/heads/1147292/000000-03f0f6@github.com> (raw)
Branch: refs/heads/1147292
Home: https://github.com/bluez/bluez
Commit: 03f0f67b8b04b464cb99f8d8f2f7e5543508be35
https://github.com/bluez/bluez/commit/03f0f67b8b04b464cb99f8d8f2f7e5543508be35
Author: Paul Menzel <pmenzel@molgen.mpg.de>
Date: 2026-08-17 (Mon, 17 Aug 2026)
Changed paths:
M Makefile.obexd
M obexd/plugins/phonebook-dummy.c
M obexd/plugins/phonebook-ebook.c
M obexd/plugins/phonebook-tracker.c
A obexd/plugins/phonebook.c
M obexd/plugins/phonebook.h
Log Message:
-----------
obexd: Reference count the phonebook back-end setup and teardown
Stopping obexd on Debian sid/unstable with *bluez* 5.87-1 logs a GObject
critical:
obexd[10687]: Terminating
systemd[1804]: Stopping obex.service - Bluetooth OBEX service...
obexd[10687]: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
systemd[1804]: Stopped obex.service - Bluetooth OBEX service.
Two builtin plugins use the phonebook back-end: pbap (pbap_init() at
obexd/plugins/pbap.c:962, pbap_exit() at :1002) and irmc (irmc_init() at
obexd/plugins/irmc.c:446, irmc_exit() at :473). Each calls phonebook_init()
when it is loaded and phonebook_exit() when it is unloaded, but neither the
callers nor the back-end track ownership of the singleton they share.
plugin_init() therefore sets the back-end up twice and plugin_cleanup()
tears it down twice. A gdb trace of the shutdown path confirms both pairs
of calls.
The dummy back-end tolerates this by accident: phonebook_init() bails out
early when root_folder is already set, and the second phonebook_exit() only
repeats a g_free()/NULL assignment. The ebook back-end, which Debian builds
(*bluez-obexd* depends on *libebook-1.2* and *libedataserver*), does not.
Its phonebook_init() stores three GObject references in static variables
and phonebook_exit() unconditionally drops all three, so the second
teardown unrefs objects that were already finalized. The registry and the
address book are effectively singletons in evolution-data-server and merely
gain a second reference, but e_book_client_connect_sync() hands back a
fresh client on every call, so the first client leaks and the second one is
unreffed twice – hence a single critical rather than three.
Put the ownership tracking in one place instead of duplicating it in every
back-end: phonebook_init() and phonebook_exit() now live in a new shared
obexd/plugins/phonebook.c and reference count the back-end, so only the
first init and the last exit reach it. The back-end entry points are
renamed to phonebook_driver_init()/phonebook_driver_exit() so that they
cannot be called directly by mistake.
Assisted-by: Claude Code:claude-opus-5
To unsubscribe from these emails, change your notification settings at https://github.com/bluez/bluez/settings/notifications
reply other threads:[~2026-08-17 16:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bluez/bluez/push/refs/heads/1147292/000000-03f0f6@github.com \
--to=noreply@github.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox