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 { /// Pending scroll events. pending_scroll_events: Vec, + + /// Has a Quit event been seen? + has_seen_quit_event: bool, } pub struct ScrollEvent { @@ -217,6 +220,7 @@ impl IOCompositor { fragment_point: None, outstanding_paint_msgs: 0, last_composite_time: 0, + has_seen_quit_event: false, } } @@ -787,10 +791,13 @@ impl IOCompositor { } 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; + } } } }