diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index cec20412a29..0b5358805dd 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -768,6 +768,12 @@ where join_handle .join() .expect("Failed to join on the fetch thread in the constellation"); + + // Note: the last thing the constellation does, is asking the embedder to + // shut down. This helps ensure we've shut down all our internal threads before + // de-initializing Servo (see the `thread_count` warning on MacOS). + debug!("Asking embedding layer to complete shutdown."); + self.embedder_proxy.send(EmbedderMsg::ShutdownComplete); } /// Generate a new pipeline id namespace. @@ -2719,9 +2725,6 @@ where } } - debug!("Asking embedding layer to complete shutdown."); - self.embedder_proxy.send(EmbedderMsg::ShutdownComplete); - debug!("Shutting-down IPC router thread in constellation."); ROUTER.shutdown();