From c32c0ac9dc62f86493ea8fa98217d92f53cdca70 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 22 Jun 2017 17:48:04 -0500 Subject: [PATCH] Drop root_flow to avoid rule node leaks --- components/layout_thread/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) 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(); }