From d61c3ebc977fe500906372e20d84557c0fdb5d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sun, 12 Nov 2023 11:03:05 +0100 Subject: [PATCH] camera-paintable: Do not unwrap channel errors --- src/contrib/qr_code_scanner/camera_paintable.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/contrib/qr_code_scanner/camera_paintable.rs b/src/contrib/qr_code_scanner/camera_paintable.rs index 04113806..ef5632e8 100644 --- a/src/contrib/qr_code_scanner/camera_paintable.rs +++ b/src/contrib/qr_code_scanner/camera_paintable.rs @@ -25,7 +25,7 @@ use gtk::{ subclass::prelude::*, }; use matrix_sdk::encryption::verification::QrVerificationData; -use tracing::error; +use tracing::{debug, error}; use crate::contrib::qr_code_scanner::{qr_code_detector::QrCodeDetector, QrVerificationDataBoxed}; @@ -213,14 +213,19 @@ impl CameraPaintable { paintable.connect_invalidate_contents(move |_| { if let Some(sender) = sender.take() { - sender.send(()).unwrap(); + if sender.send(()).is_err() { + error!("Failed to send camera paintable `invalidate-contents` signal"); + } } }); self.set_sink_paintable(paintable); pipeline.set_state(gst::State::Playing).unwrap(); self.set_pipeline(Some((pipeline, bus_guard))); - receiver.await.unwrap(); + + if receiver.await.is_err() { + debug!("Camera paintable `invalidate-contents` signal sender was dropped"); + } } fn set_sink_paintable(&self, paintable: gdk::Paintable) {