don't panic if we ever fail to lock here

This commit is contained in:
William Casarin
2022-11-30 11:10:49 -08:00
parent ad1a1dd774
commit 1fe860421b

View File

@@ -34,18 +34,19 @@ struct ExampleRepaintSignal(std::sync::Mutex<winit::event_loop::EventLoopProxy<W
impl epi::backend::RepaintSignal for ExampleRepaintSignal {
fn request_repaint(&self) {
self.0
.lock()
.unwrap_or_else(|e| {
panic!(
match self.0.lock() {
Err(e) => {
error!(
"Failed to lock guard at {} line {} with error\n{}",
file!(),
line!(),
e
)
})
.send_event(WinitEvent::RequestRedraw)
.ok();
);
}
Ok(e) => {
let _ = e.send_event(WinitEvent::RequestRedraw);
}
};
}
}