From 80a9e2c316d81908c5992541331010d3f0a64f47 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 6 Apr 2015 16:47:39 +0200 Subject: Fix wait_events() not stopping when window is closed on X11 --- src/x11/window/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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 { 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 } } -- cgit v1.2.3