Skip to content

Commit

Permalink
Drop root_flow to avoid rule node leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jryans committed Jun 22, 2017
1 parent 87c51bd commit c32c0ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/layout_thread/lib.rs
Expand Up @@ -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();
}
Expand Down

0 comments on commit c32c0ac

Please sign in to comment.