mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make IOCompositor only respond to the first Quit event.
This avoids huge mpsc_queue build-ups from the flood of Quit events coming from glutin. Fixes #5234.
This commit is contained in:
parent
1092ca1019
commit
2b10f6e7ea
1 changed files with 11 additions and 4 deletions
|
@ -128,6 +128,9 @@ pub struct IOCompositor<Window: WindowMethods> {
|
||||||
|
|
||||||
/// Pending scroll events.
|
/// Pending scroll events.
|
||||||
pending_scroll_events: Vec<ScrollEvent>,
|
pending_scroll_events: Vec<ScrollEvent>,
|
||||||
|
|
||||||
|
/// Has a Quit event been seen?
|
||||||
|
has_seen_quit_event: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ScrollEvent {
|
pub struct ScrollEvent {
|
||||||
|
@ -217,6 +220,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
fragment_point: None,
|
fragment_point: None,
|
||||||
outstanding_paint_msgs: 0,
|
outstanding_paint_msgs: 0,
|
||||||
last_composite_time: 0,
|
last_composite_time: 0,
|
||||||
|
has_seen_quit_event: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,10 +791,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowEvent::Quit => {
|
WindowEvent::Quit => {
|
||||||
debug!("shutting down the constellation for WindowEvent::Quit");
|
if !self.has_seen_quit_event {
|
||||||
let ConstellationChan(ref chan) = self.constellation_chan;
|
self.has_seen_quit_event = true;
|
||||||
chan.send(ConstellationMsg::Exit).unwrap();
|
debug!("shutting down the constellation for WindowEvent::Quit");
|
||||||
self.shutdown_state = ShutdownState::ShuttingDown;
|
let ConstellationChan(ref chan) = self.constellation_chan;
|
||||||
|
chan.send(ConstellationMsg::Exit).unwrap();
|
||||||
|
self.shutdown_state = ShutdownState::ShuttingDown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue