mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Remove an invalid assert.
This assert was wrong. The assert may fire if we resurrect the node from a different thread and insert a kid fast enough. We allow resurrecting nodes (bumping the nodes from zero to one) to avoid allocation churn. In particular, while the thread dropping the node gets to read the children (so after the fetch_sub from the refcount, but before the read() of the children), another thread could plausibly bumped the refcount back, and added a children. This is a very big edge case of course, but I'm kinda sad I hadn't realized before. Differential Revision: https://phabricator.services.mozilla.com/D63286
This commit is contained in:
parent
471e491a89
commit
c52bae1923
1 changed files with 0 additions and 64 deletions
|
@ -136,29 +136,6 @@ impl StyleSource {
|
||||||
let _ = write!(writer, " -> {:?}", self.read(guard).declarations());
|
let _ = write!(writer, " -> {:?}", self.read(guard).declarations());
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is totally unsafe, should be removed when we figure out the cause of
|
|
||||||
// bug 1607553.
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
unsafe fn dump_unchecked<W: Write>(&self, writer: &mut W) {
|
|
||||||
if let Some(ref rule) = self.0.as_first() {
|
|
||||||
let rule = rule.read_unchecked();
|
|
||||||
let _ = write!(writer, "{:?}", rule.selectors);
|
|
||||||
}
|
|
||||||
let _ = write!(writer, " -> {:?}", self.read_unchecked().declarations());
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is totally unsafe, should be removed when we figure out the cause of
|
|
||||||
// bug 1607553.
|
|
||||||
#[inline]
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
unsafe fn read_unchecked(&self) -> &PropertyDeclarationBlock {
|
|
||||||
let block: &Locked<PropertyDeclarationBlock> = match self.0.borrow() {
|
|
||||||
ArcUnionBorrow::First(ref rule) => &rule.get().read_unchecked().block,
|
|
||||||
ArcUnionBorrow::Second(ref block) => block.get(),
|
|
||||||
};
|
|
||||||
block.read_unchecked()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Read the style source guard, and obtain thus read access to the
|
/// Read the style source guard, and obtain thus read access to the
|
||||||
/// underlying property declaration block.
|
/// underlying property declaration block.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1742,47 +1719,6 @@ impl Drop for StrongRuleNode {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
#[inline(always)]
|
|
||||||
fn assert_on_release() -> bool {
|
|
||||||
crate::gecko_bindings::structs::GECKO_IS_NIGHTLY
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
fn assert_on_release() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
if cfg!(debug_assertions) || assert_on_release() {
|
|
||||||
let children = node.children.read();
|
|
||||||
if !children.is_empty() {
|
|
||||||
let mut crash_str = vec![];
|
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
unsafe {
|
|
||||||
// Try to unsafely collect some information of this before
|
|
||||||
// crashing the process.
|
|
||||||
if let Some(ref s) = node.source {
|
|
||||||
s.dump_unchecked(&mut crash_str);
|
|
||||||
crash_str.push(b'\n');
|
|
||||||
}
|
|
||||||
children.each(|child| {
|
|
||||||
(*child.ptr())
|
|
||||||
.source
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.dump_unchecked(&mut crash_str);
|
|
||||||
crash_str.push(b'\n');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
panic!(
|
|
||||||
"Children left in the rule tree on drop: {}",
|
|
||||||
String::from_utf8_lossy(&crash_str).trim()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if node.parent.is_none() {
|
if node.parent.is_none() {
|
||||||
debug!("Dropping root node!");
|
debug!("Dropping root node!");
|
||||||
// The free list should be null by this point
|
// The free list should be null by this point
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue