aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r--components/layout_thread/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index ce3a7e28b7d..96eac55cc5b 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -793,6 +793,10 @@ impl LayoutThread {
/// Shuts down the layout thread now. If there are any DOM nodes left, layout will now (safely)
/// crash.
fn exit_now(&mut self) {
+ // Drop the root flow explicitly to avoid holding style data, such as
+ // rule nodes. The `Stylist` checks when it is dropped that all rule
+ // nodes have been GCed, so we want drop anyone who holds them first.
+ self.root_flow.borrow_mut().take();
// Drop the rayon threadpool if present.
let _ = self.parallel_traversal.take();
}