diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-03-16 22:21:49 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-03-16 22:21:49 -0600 |
commit | 2281bca89252d8e37771ce2446fb5871a69903d0 (patch) | |
tree | ba819c2ed1048d7db878d322e2d9ca82d5287418 | |
parent | f093620922621e1877393b03968ed0ce767fdf12 (diff) | |
parent | 2b10f6e7ea1c5a6bd6adcb5ed845c7bcb94f8e35 (diff) | |
download | servo-2281bca89252d8e37771ce2446fb5871a69903d0.tar.gz servo-2281bca89252d8e37771ce2446fb5871a69903d0.zip |
auto merge of #5245 : nnethercote/servo/only-one-quit-event, r=glennw
This fixes #5234, in that the huge memory spike disappears. It still takes ~15 seconds for the window to actually disappear after that first `Quit` event is received by the IOCompositor. Maybe that's a pre-existing problem.
There may be better ways to do this, like handling it on the sending side (i.e. within glutin) instead of the receiving side. I just did it this way because it seemed like the easiest thing.
-rw-r--r-- | components/compositing/compositor.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 799f231417b..a45f2d7a9e8 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; + } } } } |