mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 14:20:05 -04:00
wayland: Reset the intterupted flag before breaking from run_forever
This is important for any code that re-enters `run_forever` after some previous interrupt.
This commit is contained in:
@@ -193,7 +193,13 @@ impl EventsLoop {
|
|||||||
let static_cb = unsafe { ::std::mem::transmute(Box::new(callback) as Box<FnMut(_)>) };
|
let static_cb = unsafe { ::std::mem::transmute(Box::new(callback) as Box<FnMut(_)>) };
|
||||||
let old_cb = unsafe { self.sink.lock().unwrap().set_callback(static_cb) };
|
let old_cb = unsafe { self.sink.lock().unwrap().set_callback(static_cb) };
|
||||||
|
|
||||||
while !self.interrupted.load(::std::sync::atomic::Ordering::Relaxed) {
|
loop {
|
||||||
|
// If `interrupt` was called, break from the loop after resetting the flag.
|
||||||
|
if self.interrupted.load(::std::sync::atomic::Ordering::Relaxed) {
|
||||||
|
self.interrupted.store(false, ::std::sync::atomic::Ordering::Relaxed);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
self.ctxt.dispatch();
|
self.ctxt.dispatch();
|
||||||
evq_guard.dispatch_pending().expect("Wayland connection unexpectedly lost");
|
evq_guard.dispatch_pending().expect("Wayland connection unexpectedly lost");
|
||||||
let ids_guard = self.decorated_ids.lock().unwrap();
|
let ids_guard = self.decorated_ids.lock().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user