Allow StrongRuleNode drops after RuleTree destruction.

This commit is contained in:
Bobby Holley 2017-06-29 23:20:26 -07:00
parent 67cd974636
commit 6ade9c11ec
2 changed files with 34 additions and 21 deletions

View file

@ -1369,21 +1369,6 @@ impl Stylist {
}
}
impl Drop for Stylist {
fn drop(&mut self) {
// This is the last chance to GC the rule tree. If we have dropped all
// strong rule node references before the Stylist is dropped, then this
// will cause the rule tree to be destroyed correctly. If we haven't
// dropped all strong rule node references before now, then we will
// leak them, since there will be no way to call gc() on the rule tree
// after this point.
unsafe { self.rule_tree.gc(); }
// Assert against leaks.
debug_assert!(self.rule_tree.is_empty());
}
}
/// Visitor to collect names that appear in attribute selectors and any
/// dependencies on ElementState bits.
struct AttributeAndStateDependencyVisitor<'a> {