constellation: send EmbedderMsg::ShutdownComplete as last (#38923)

To help ensure our internal threads have shut-down before we deinit
Servo, the last thing the constellation should do, is sending the
`EmbedderMsg::ShutdownComplete`.

Testing: Manual testing by starting Servo and then closing the window. 
Fixes: Part of https://github.com/servo/servo/issues/30849

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Gregory Terzian 2025-08-26 23:22:11 +08:00 committed by GitHub
parent c75995ec87
commit 909ceee830
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -768,6 +768,12 @@ where
join_handle join_handle
.join() .join()
.expect("Failed to join on the fetch thread in the constellation"); .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. /// 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."); debug!("Shutting-down IPC router thread in constellation.");
ROUTER.shutdown(); ROUTER.shutdown();