don't panic if we ever fail to lock here
This commit is contained in:
17
src/lib.rs
17
src/lib.rs
@@ -34,18 +34,19 @@ struct ExampleRepaintSignal(std::sync::Mutex<winit::event_loop::EventLoopProxy<W
|
|||||||
|
|
||||||
impl epi::backend::RepaintSignal for ExampleRepaintSignal {
|
impl epi::backend::RepaintSignal for ExampleRepaintSignal {
|
||||||
fn request_repaint(&self) {
|
fn request_repaint(&self) {
|
||||||
self.0
|
match self.0.lock() {
|
||||||
.lock()
|
Err(e) => {
|
||||||
.unwrap_or_else(|e| {
|
error!(
|
||||||
panic!(
|
|
||||||
"Failed to lock guard at {} line {} with error\n{}",
|
"Failed to lock guard at {} line {} with error\n{}",
|
||||||
file!(),
|
file!(),
|
||||||
line!(),
|
line!(),
|
||||||
e
|
e
|
||||||
)
|
);
|
||||||
})
|
}
|
||||||
.send_event(WinitEvent::RequestRedraw)
|
Ok(e) => {
|
||||||
.ok();
|
let _ = e.send_event(WinitEvent::RequestRedraw);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user