Use Atom::from(nsIAtom) to increment reference count in case of dynamic atom for will-change.

If we don't increment the reference count for the Atom in servo side, it's
possible to try to release the Atom in servo side even if we have already
released in gecko side.  When it happens, nsIAtom::mKind is no longer reliable.
This commit is contained in:
Hiroyuki Ikezoe 2017-09-21 15:37:50 +09:00
parent 5afb1b7dd2
commit dcd959fc72

View file

@ -3482,7 +3482,6 @@ fn static_assert() {
pub fn clone_will_change(&self) -> longhands::will_change::computed_value::T { pub fn clone_will_change(&self) -> longhands::will_change::computed_value::T {
use properties::longhands::will_change::computed_value::T; use properties::longhands::will_change::computed_value::T;
use gecko_bindings::structs::nsIAtom; use gecko_bindings::structs::nsIAtom;
use gecko_string_cache::Atom;
use values::CustomIdent; use values::CustomIdent;
if self.gecko.mWillChange.mBuffer.len() == 0 { if self.gecko.mWillChange.mBuffer.len() == 0 {
@ -3490,9 +3489,7 @@ fn static_assert() {
} else { } else {
T::AnimateableFeatures( T::AnimateableFeatures(
self.gecko.mWillChange.mBuffer.iter().map(|gecko_atom| { self.gecko.mWillChange.mBuffer.iter().map(|gecko_atom| {
CustomIdent( CustomIdent((*gecko_atom as *mut nsIAtom).into())
unsafe { Atom::from_addrefed(*gecko_atom as *mut nsIAtom) }
)
}).collect() }).collect()
) )
} }