Drop root_flow to avoid rule node leaks

This commit is contained in:
J. Ryan Stinnett 2017-06-22 17:48:04 -05:00
parent 87c51bd8bf
commit c32c0ac9dc

View file

@ -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();
}