From 31a967f6da2474ada3ab0f763180f2dde6bc7adf Mon Sep 17 00:00:00 2001 From: Marcus Lian Hanestad Date: Wed, 1 Jan 2025 21:18:57 +0100 Subject: [PATCH] don't panic in Drop when video worker thread panics --- src/video.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video.rs b/src/video.rs index f7a564a..1d07d60 100644 --- a/src/video.rs +++ b/src/video.rs @@ -189,7 +189,12 @@ impl Drop for Video { inner.alive.store(false, Ordering::SeqCst); if let Some(worker) = inner.worker.take() { - worker.join().expect("failed to stop video thread"); + if let Err(err) = worker.join() { + match err.downcast_ref::() { + Some(e) => log::error!("Video thread panicked: {e}"), + None => log::error!("Video thread panicked with unknown reason"), + } + } } } }