Merge pull request #361 from tomaka/x11-closing

Fix wait_events() not stopping when window is closed on X11
This commit is contained in:
tomaka 2015-04-06 21:46:38 +02:00
commit 68856c3add

View file

@ -255,7 +255,7 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
fn next(&mut self) -> Option<Event> { fn next(&mut self) -> Option<Event> {
use std::mem; use std::mem;
loop { while !self.window.is_closed() {
if let Some(ev) = self.window.pending_events.lock().unwrap().pop_front() { if let Some(ev) = self.window.pending_events.lock().unwrap().pop_front() {
return Some(ev); return Some(ev);
} }
@ -270,6 +270,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
return Some(ev); return Some(ev);
} }
} }
None
} }
} }