From bf29892aa4a474ad76136755aa0fd396bf8f60b2 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 13 Jul 2026 21:15:22 -0600 Subject: [PATCH] fix(dsd): DsdErrorReport holds SharedState, not Arc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The merged #599 typed DsdErrorReport.state as Arc, but the audio thread passes thread_state — a SharedState, which is itself a #[derive(Clone)] handle of Arc fields (a clone already shares the state). The extra Arc broke the qbz-player build in the combined pre-release (E0308 at the four DoP / native-DSD wrap sites), failing the test-crates CI. Switches the field + new() to SharedState and drops the now-redundant Arc::new in the two DSD tests. Verified with scripts/cargo-test.sh (workspace, no UI): all crates green. cc --- crates/qbz-player/src/player/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/qbz-player/src/player/mod.rs b/crates/qbz-player/src/player/mod.rs index 4afefe8f9..52c10b34c 100644 --- a/crates/qbz-player/src/player/mod.rs +++ b/crates/qbz-player/src/player/mod.rs @@ -5233,13 +5233,16 @@ pub struct PlaybackState { #[cfg_attr(not(target_os = "linux"), allow(dead_code))] struct DsdErrorReport { inner: S, - state: Arc, + // SharedState is a #[derive(Clone)] handle of Arc fields, so a + // clone already shares the same state — no extra Arc wrapper (that is also + // the type `thread_state` is passed around as at the call sites). + state: SharedState, reported: bool, } #[cfg_attr(not(target_os = "linux"), allow(dead_code))] impl DsdErrorReport { - fn new(inner: S, state: Arc) -> Self { + fn new(inner: S, state: SharedState) -> Self { Self { inner, state, @@ -5285,7 +5288,6 @@ mod tests { use super::compute_needs_new_stream; use super::external_content_type; use super::{DsdErrorReport, SharedState}; - use std::sync::Arc; struct FakeDsdSource { words: std::vec::IntoIter, @@ -5307,7 +5309,7 @@ mod tests { #[test] fn dsd_error_report_surfaces_io_error_at_stream_end() { - let state = Arc::new(SharedState::new()); + let state = SharedState::new(); let source = FakeDsdSource { words: vec![1, 2].into_iter(), error: Some("read failed".to_string()), @@ -5327,7 +5329,7 @@ mod tests { #[test] fn dsd_error_report_clean_eof_is_not_an_error() { - let state = Arc::new(SharedState::new()); + let state = SharedState::new(); let source = FakeDsdSource { words: vec![1].into_iter(), error: None,