mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix memory leak in flow tree by adding weak refs.
Cycles were being created in the flow tree since absolutely positioned descendants had pointers to their containing blocks. This adds WeakFlowRef (based on Weak<T>) and makes these backpointers weak references. This also harmonizes our custom Arc<T>, FlowRef, to be consistent with the upstream implementation. Fixes #4915.
This commit is contained in:
parent
660ea05ddb
commit
237150fa49
4 changed files with 147 additions and 18 deletions
|
@ -804,8 +804,12 @@ impl LayoutTask {
|
|||
}
|
||||
|
||||
if needs_reflow {
|
||||
self.try_get_layout_root(*node).map(
|
||||
|mut flow| LayoutTask::reflow_all_nodes(&mut *flow));
|
||||
match self.try_get_layout_root(*node) {
|
||||
None => {}
|
||||
Some(mut flow) => {
|
||||
LayoutTask::reflow_all_nodes(&mut *flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a layout context for use throughout the following passes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue