camera-paintable: Do not unwrap channel errors

This commit is contained in:
Kévin Commaille 2023-11-12 11:03:05 +01:00 committed by Kévin Commaille
parent 3be4f968a0
commit d61c3ebc97

View file

@ -25,7 +25,7 @@ use gtk::{
subclass::prelude::*, subclass::prelude::*,
}; };
use matrix_sdk::encryption::verification::QrVerificationData; use matrix_sdk::encryption::verification::QrVerificationData;
use tracing::error; use tracing::{debug, error};
use crate::contrib::qr_code_scanner::{qr_code_detector::QrCodeDetector, QrVerificationDataBoxed}; use crate::contrib::qr_code_scanner::{qr_code_detector::QrCodeDetector, QrVerificationDataBoxed};
@ -213,14 +213,19 @@ impl CameraPaintable {
paintable.connect_invalidate_contents(move |_| { paintable.connect_invalidate_contents(move |_| {
if let Some(sender) = sender.take() { 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); self.set_sink_paintable(paintable);
pipeline.set_state(gst::State::Playing).unwrap(); pipeline.set_state(gst::State::Playing).unwrap();
self.set_pipeline(Some((pipeline, bus_guard))); 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) { fn set_sink_paintable(&self, paintable: gdk::Paintable) {