From d945af6f852ef58ff9bb60c64e4454a617a587b7 Mon Sep 17 00:00:00 2001 From: crvs Date: Sat, 28 Feb 2026 09:06:21 +0100 Subject: [PATCH] Fix playerctld crash when playlist interface unavailable Clean up the playlist interface info when the query for playlist intefrace errors out. --- playerctl/playerctl-daemon.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/playerctl/playerctl-daemon.c b/playerctl/playerctl-daemon.c index 1d9550c..6697631 100644 --- a/playerctl/playerctl-daemon.c +++ b/playerctl/playerctl-daemon.c @@ -488,14 +488,6 @@ static void context_remove_player(struct PlayerctldContext *ctx, struct Player * } } -static void context_rotate_queue(struct PlayerctldContext *ctx) { - struct Player *player; - if ((player = g_queue_peek_head(ctx->players))) { - context_remove_player(ctx, player); - g_queue_push_tail(ctx->players, player); - } -} - static void context_unrotate_queue(struct PlayerctldContext *ctx) { struct Player *player; if ((player = g_queue_peek_tail(ctx->players))) { @@ -906,11 +898,13 @@ static void on_bus_acquired(GDBusConnection *connection, const char *name, gpoin g_clear_error(&error); } - g_dbus_connection_register_object(connection, MPRIS_PATH, ctx->playlists_interface_info, - &vtable_mpris, user_data, NULL, &error); - if (error != NULL) { - g_warning("%s", error->message); - g_clear_error(&error); + if (ctx->playlists_interface_info != NULL) { + g_dbus_connection_register_object(connection, MPRIS_PATH, ctx->playlists_interface_info, + &vtable_mpris, user_data, NULL, &error); + if (error != NULL) { + g_warning("%s", error->message); + g_clear_error(&error); + } } g_dbus_connection_register_object(connection, MPRIS_PATH, ctx->tracklist_interface_info, @@ -1490,6 +1484,7 @@ int main(int argc, char *argv[]) { if (error != NULL) { // This interface is optional, so we can keep the player around player->playlists.supported = false; + ctx.playlists_interface_info = NULL; g_warning("could not get playlists properties for player: %s", player->well_known); g_clear_error(&error); } else {