diff options
-rw-r--r-- | src/x11/window/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs index 3820bd4..7121ac6 100644 --- a/src/x11/window/mod.rs +++ b/src/x11/window/mod.rs @@ -255,7 +255,7 @@ impl<'a> Iterator for WaitEventsIterator<'a> { fn next(&mut self) -> Option<Event> { use std::mem; - loop { + while !self.window.is_closed() { if let Some(ev) = self.window.pending_events.lock().unwrap().pop_front() { return Some(ev); } @@ -270,6 +270,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> { return Some(ev); } } + + None } } |