Merge pull request #23 from MAlba124/report-video-thread-panic

don't panic in Drop when video worker thread panics
This commit is contained in:
jazzfool 2025-01-02 11:44:21 +11:00 committed by GitHub
commit 583ef3cd3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -189,7 +189,12 @@ impl Drop for Video {
inner.alive.store(false, Ordering::SeqCst); inner.alive.store(false, Ordering::SeqCst);
if let Some(worker) = inner.worker.take() { 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::<String>() {
Some(e) => log::error!("Video thread panicked: {e}"),
None => log::error!("Video thread panicked with unknown reason"),
}
}
} }
} }
} }