aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2015-03-16 19:29:38 -0700
committerNicholas Nethercote <nnethercote@mozilla.com>2015-03-16 19:32:57 -0700
commit2b10f6e7ea1c5a6bd6adcb5ed845c7bcb94f8e35 (patch)
treee7baa71c4ccc20771caf5079d5af4c0133797b92
parent1092ca10192c79b4b96c25985a2c6245d369090b (diff)
downloadservo-2b10f6e7ea1c5a6bd6adcb5ed845c7bcb94f8e35.tar.gz
servo-2b10f6e7ea1c5a6bd6adcb5ed845c7bcb94f8e35.zip
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.
-rw-r--r--components/compositing/compositor.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index af816d5a9c2..970624a7ec0 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -128,6 +128,9 @@ pub struct IOCompositor<Window: WindowMethods> {
/// Pending scroll events.
pending_scroll_events: Vec<ScrollEvent>,
+
+ /// Has a Quit event been seen?
+ has_seen_quit_event: bool,
}
pub struct ScrollEvent {
@@ -217,6 +220,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fragment_point: None,
outstanding_paint_msgs: 0,
last_composite_time: 0,
+ has_seen_quit_event: false,
}
}
@@ -787,10 +791,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
WindowEvent::Quit => {
- debug!("shutting down the constellation for WindowEvent::Quit");
- let ConstellationChan(ref chan) = self.constellation_chan;
- chan.send(ConstellationMsg::Exit).unwrap();
- self.shutdown_state = ShutdownState::ShuttingDown;
+ if !self.has_seen_quit_event {
+ self.has_seen_quit_event = true;
+ debug!("shutting down the constellation for WindowEvent::Quit");
+ let ConstellationChan(ref chan) = self.constellation_chan;
+ chan.send(ConstellationMsg::Exit).unwrap();
+ self.shutdown_state = ShutdownState::ShuttingDown;
+ }
}
}
}