Skip to content

Commit

Permalink
fix borrow logic when sending deferred events
Browse files Browse the repository at this point in the history
  • Loading branch information
httnn committed May 29, 2024
1 parent fc180ff commit 480fc8e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,13 @@ impl WindowState {

fn send_deferred_events(&self, window_handler: &mut dyn WindowHandler) {
let mut window = crate::Window::new(Window { inner: &self.window_inner });
while let Some(event) = self.deferred_events.borrow_mut().pop_front() {
window_handler.on_event(&mut window, event);
loop {
let next_event = self.deferred_events.borrow_mut().pop_front();
if let Some(event) = next_event {
window_handler.on_event(&mut window, event);
} else {
break;
}
}
}
}
Expand Down

0 comments on commit 480fc8e

Please sign in to comment.