From 88064137ca8f5259dda800d784ccb9e2bb2f65b7 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 5 Jul 2026 10:10:26 +0200 Subject: [PATCH] fix(mpris): clear stale GError in playerctld selection loop When playerctl_player_new_from_name() fails for a candidate player, the loop continued without clearing the GError. The stale non-NULL error then leaked into the next GLib call (GLib-CRITICAL assertion) and made the post-loop 'if (error) goto errorexit' fire even when a valid playing player had been selected, blanking the whole module. Clear the error at the discard point with g_clear_error(). --- src/modules/mpris/mpris.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/mpris/mpris.cpp b/src/modules/mpris/mpris.cpp index 387e0597..d70f5902 100644 --- a/src/modules/mpris/mpris.cpp +++ b/src/modules/mpris/mpris.cpp @@ -491,7 +491,13 @@ auto Mpris::getPlayerInfo() -> std::optional { continue; } auto* tmp = playerctl_player_new_from_name(pn, &error); - if (error || !tmp) continue; + if (error || !tmp) { + // Discard any error from this candidate so it doesn't leak into the next + // playerctl_player_new_from_name() call or the post-loop metadata calls, which + // assert that the passed GError is NULL (otherwise: GLib-CRITICAL / spurious errorexit). + g_clear_error(&error); + continue; + } if (!first_valid_player) { first_valid_player = tmp; first_valid_name = name;