From 4b50645c93c4c17e1f157f5e57c706c5685c7bfb Mon Sep 17 00:00:00 2001 From: Tarasov Aleksandr <55220741+arabianq@users.noreply.github.com> Date: Sun, 8 Mar 2026 00:25:42 +0300 Subject: [PATCH] refactor(gui): replace unsafe unwrap on gui thread lock (#23) Replaces `audio_player_state_shared.lock().unwrap()` with `.unwrap_or_else(|e| e.into_inner())` in `src/utils/gui.rs` to allow safe recovery from poisoned locks and avoid application panics. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- src/types/commands.rs | 2 +- src/utils/gui.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/types/commands.rs b/src/types/commands.rs index 8e149eb..ecb4dbf 100644 --- a/src/types/commands.rs +++ b/src/types/commands.rs @@ -197,7 +197,7 @@ impl Executable for GetVolumeCommand { let volume = audio_player.get_volume(self.id); if let Some(volume) = volume { - Response::new(true, volume.to_string()) + Response::new(true, volume.to_string()) } else { Response::new(false, "Failed to get volume") } diff --git a/src/utils/gui.rs b/src/utils/gui.rs index 45a3d3d..9687666 100644 --- a/src/utils/gui.rs +++ b/src/utils/gui.rs @@ -55,7 +55,9 @@ pub fn start_app_state_thread(audio_player_state_shared: Arc {