diff options
author | bors-servo <release+servo@mozilla.com> | 2014-05-08 12:16:12 -0400 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-05-08 12:16:12 -0400 |
commit | bfffbe94eacb63fe7fe3fc2cfed433cb20cd4c41 (patch) | |
tree | 4498e931d30fe673cf4a7d62d13606a0a5d06cba | |
parent | a0922f9d7274e0781f30cdacf978104c224010f7 (diff) | |
parent | d11716e27b539a98bba64f25c79c06ad92a409aa (diff) | |
download | servo-bfffbe94eacb63fe7fe3fc2cfed433cb20cd4c41.tar.gz servo-bfffbe94eacb63fe7fe3fc2cfed433cb20cd4c41.zip |
auto merge of #2369 : glennw/servo/issue-2308, r=metajack
There might be a "cleaner" rust way to separate the scope and invoke the drop() call?
-rw-r--r-- | src/components/main/layout/parallel.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/components/main/layout/parallel.rs b/src/components/main/layout/parallel.rs index 983ba09d4d5..44ce3b9fad8 100644 --- a/src/components/main/layout/parallel.rs +++ b/src/components/main/layout/parallel.rs @@ -299,7 +299,15 @@ fn recalc_style_for_node(unsafe_layout_node: UnsafeLayoutNode, } &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. for kid in node.children() { proxy.push(WorkUnit { |