All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Cc: George Kiagiadakis <george.kiagiadakis@collabora.com>
Subject: [PATCH BlueZ 2/5] player: Answer pending request when the player is destroyed
Date: Fri, 21 Aug 2026 22:34:46 +0300	[thread overview]
Message-ID: <20260821193449.1336263-3-george.kiagiadakis@collabora.com> (raw)
In-Reply-To: <20260821193449.1336263-1-george.kiagiadakis@collabora.com>

media_player_destroy() dropped its reference to the pending request
without answering it. A client with a ListItems(), Search(),
ChangeFolder() or Play() in flight was therefore left waiting for its
own D-Bus timeout to expire, 25s by default, whenever the player went
away. That happens on every AVRCP disconnect, since avrcp destroys the
controller player from its disconnect path.

Reply with org.bluez.Error.Failed instead.

Answering after the g_dbus_unregister_interface() calls above is fine,
as replies are matched by serial rather than by object path, so the
unref site does not need to move.

Assisted-by: Claude:claude-opus-5 valgrind
---
 profiles/audio/player.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 568c70770..fa3810a7f 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -1257,8 +1257,11 @@ void media_player_destroy(struct media_player *mp)
 						mp->path,
 						MEDIA_FOLDER_INTERFACE);
 
-	if (mp->msg)
+	if (mp->msg) {
+		g_dbus_send_message(btd_get_dbus_connection(),
+				btd_error_failed(mp->msg, "Player removed"));
 		dbus_message_unref(mp->msg);
+	}
 
 	g_slist_free_full(mp->pending, g_free);
 	g_slist_free_full(mp->folders, media_folder_destroy);
-- 
2.54.0 (Apple Git-157)


  parent reply	other threads:[~2026-08-21 19:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 19:34 [PATCH BlueZ 0/5] player: Fix crash and related defects around the pending request George Kiagiadakis
2026-08-21 19:34 ` [PATCH BlueZ 1/5] player: Fix crash on MediaItem1.Play() without a browsing scope George Kiagiadakis
2026-08-21 20:38   ` player: Fix crash and related defects around the pending request bluez.test.bot
2026-08-21 19:34 ` George Kiagiadakis [this message]
2026-08-21 19:34 ` [PATCH BlueZ 3/5] player: Fix NumberOfItems never being updated on SetBrowsedPlayer George Kiagiadakis
2026-08-21 19:34 ` [PATCH BlueZ 4/5] player: Report EBUSY from a busy Search() George Kiagiadakis
2026-08-21 19:34 ` [PATCH BlueZ 5/5] unit/test-media-player: Add media player tests George Kiagiadakis
2026-08-24 20:40 ` [PATCH BlueZ 0/5] player: Fix crash and related defects around the pending request patchwork-bot+bluetooth

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=20260821193449.1336263-3-george.kiagiadakis@collabora.com \
    --to=george.kiagiadakis@collabora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.