From bfb0366c90f9fb73d5f96eeb545f145b3be3166e Mon Sep 17 00:00:00 2001 From: JasonLG1979 Date: Fri, 23 Jun 2023 10:10:14 -0500 Subject: [PATCH] Make sure the ResampleWorker task_receiver is also drained on drop --- playback/src/resampler.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/playback/src/resampler.rs b/playback/src/resampler.rs index a087d2fc..560ffea5 100644 --- a/playback/src/resampler.rs +++ b/playback/src/resampler.rs @@ -288,6 +288,14 @@ impl ResampleWorker { .ok(); } ResampleTask::Terminate => { + loop { + let drained = task_receiver.recv().ok(); + + if drained.is_none() { + break; + } + } + match thread::current().name() { Some(name) => debug!(" [{name}] thread finished"), None => debug!(" thread finished"),