We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c852b72 commit 7ab8bd7Copy full SHA for 7ab8bd7
1 file changed
linux-rust/src/media_controller.rs
@@ -902,8 +902,16 @@ impl MediaController {
902
903
info!("Deactivating A2DP profile for AirPods by setting to off");
904
905
+ // Use catch_unwind to prevent panics in libpulse-binding from crashing the app
906
let success =
- tokio::task::spawn_blocking(move || set_card_profile_sync(device_index, "off"))
907
+ tokio::task::spawn_blocking(move || {
908
+ std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
909
+ set_card_profile_sync(device_index, "off")
910
+ })).unwrap_or_else(|e| {
911
+ warn!("Panic in set_card_profile_sync: {:?}", e);
912
+ false
913
+ })
914
915
.await
916
.unwrap_or(false);
917
0 commit comments