mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Allow StrongRuleNode drops after RuleTree destruction.
This commit is contained in:
parent
67cd974636
commit
6ade9c11ec
2 changed files with 34 additions and 21 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue