diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-20 14:23:39 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 14:23:39 -0600 |
commit | 976989fc8d6a61391b35639943c63e6aaa27068b (patch) | |
tree | 72d594c66da9ed775c31c23e305bf02ca5686e1e | |
parent | ac6a2681ae9f94827ebd989c3d3c3b175cbb455f (diff) | |
parent | 5c98dffea6cbacfb7c3e1f944fa0dda93e354ccf (diff) | |
download | servo-976989fc8d6a61391b35639943c63e6aaa27068b.tar.gz servo-976989fc8d6a61391b35639943c63e6aaa27068b.zip |
Auto merge of #14278 - emilio:layout-data-in-script, r=Ms2ger
style: Don't assert when the final rule tree GC happens in script.
This should silence the assertions in https://github.com/servo/servo/issues/14213.
r? @Ms2ger
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14278)
<!-- Reviewable:end -->
-rw-r--r-- | components/style/rule_tree/mod.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/components/style/rule_tree/mod.rs b/components/style/rule_tree/mod.rs index 394e1f88d60..2e87a30c212 100644 --- a/components/style/rule_tree/mod.rs +++ b/components/style/rule_tree/mod.rs @@ -427,15 +427,23 @@ impl StrongRuleNode { } unsafe fn pop_from_free_list(&self) -> Option<WeakRuleNode> { - debug_assert!(thread_state::get().is_layout() && - !thread_state::get().is_worker()); - // NB: This can run from the root node destructor, so we can't use // `get()`, since it asserts the refcount is bigger than zero. let me = &*self.ptr; + debug_assert!(me.is_root()); + // FIXME(#14213): Apparently the layout data can be gone from script. + // + // That's... suspicious, but it's fine if it happens for the rule tree + // case, so just don't crash in the case we're doing the final GC in + // script. + debug_assert!(!thread_state::get().is_worker() && + (thread_state::get().is_layout() || + (thread_state::get().is_script() && + me.refcount.load(Ordering::SeqCst) == 0))); let current = me.next_free.load(Ordering::SeqCst); + if current == FREE_LIST_SENTINEL { return None; } |