From 8d00ca74fcdd0963a905f35e532f007145014245 Mon Sep 17 00:00:00 2001 From: Thomas Frans Date: Wed, 4 Oct 2023 11:51:52 +0200 Subject: [PATCH] fix: MPRIS loop `tokio::select!()` panic on exit This fixes a bug that would cause a panic when quiting the process normally. `tokio::select!()` was used to await a single branch, which is useless as it can be replaced by a normal await. --- src/mpris.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/mpris.rs b/src/mpris.rs index bf1cb7f..a7fda8a 100644 --- a/src/mpris.rs +++ b/src/mpris.rs @@ -513,13 +513,10 @@ impl MprisManager { let player_iface = player_iface_ref.get().await; loop { - tokio::select! { - Some(()) = rx.next() => { - let ctx = player_iface_ref.signal_context(); - player_iface.playback_status_changed(ctx).await?; - player_iface.metadata_changed(ctx).await?; - } - } + rx.next().await; + let ctx = player_iface_ref.signal_context(); + player_iface.playback_status_changed(ctx).await?; + player_iface.metadata_changed(ctx).await?; } }