Skip to content

Commit

Permalink
fix: MPRIS loop tokio::select!() panic on exit
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ThomasFrans committed Oct 4, 2023
1 parent b27b067 commit 7396706
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
}
}

Expand Down

0 comments on commit 7396706

Please sign in to comment.