mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Fix for parallel data race in layout code. Fixes #2308.
This commit is contained in:
parent
15d3257a29
commit
d11716e27b
1 changed files with 8 additions and 0 deletions
|
@ -299,7 +299,15 @@ fn recalc_style_for_node(unsafe_layout_node: UnsafeLayoutNode,
|
||||||
}
|
}
|
||||||
&None => fail!("no layout data"),
|
&None => fail!("no layout data"),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's *very* important that this block is in a separate scope to the block above,
|
||||||
|
// to avoid a data race that can occur (github issue #2308). The block above issues
|
||||||
|
// a borrow on the node layout data. That borrow must be dropped before the child
|
||||||
|
// nodes are actually pushed into the work queue. Otherwise, it's possible for a child
|
||||||
|
// node to get into construct_flows() and move up it's parent hierarchy, which can call
|
||||||
|
// borrow on the layout data before it is dropped from the block above.
|
||||||
|
if child_count != 0 {
|
||||||
// Enqueue kids.
|
// Enqueue kids.
|
||||||
for kid in node.children() {
|
for kid in node.children() {
|
||||||
proxy.push(WorkUnit {
|
proxy.push(WorkUnit {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue