Skip to content

Commit

Permalink
Use Atom::from(nsIAtom) to increment reference count in case of dynam…
Browse files Browse the repository at this point in the history
…ic 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.
  • Loading branch information
Hiroyuki Ikezoe committed Sep 21, 2017
1 parent 5afb1b7 commit dcd959f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions components/style/properties/gecko.mako.rs
Expand Up @@ -3482,17 +3482,14 @@ fn static_assert() {
pub fn clone_will_change(&self) -> longhands::will_change::computed_value::T {
use properties::longhands::will_change::computed_value::T;
use gecko_bindings::structs::nsIAtom;
use gecko_string_cache::Atom;
use values::CustomIdent;

if self.gecko.mWillChange.mBuffer.len() == 0 {
T::Auto
} else {
T::AnimateableFeatures(
self.gecko.mWillChange.mBuffer.iter().map(|gecko_atom| {
CustomIdent(
unsafe { Atom::from_addrefed(*gecko_atom as *mut nsIAtom) }
)
CustomIdent((*gecko_atom as *mut nsIAtom).into())
}).collect()
)
}
Expand Down

0 comments on commit dcd959f

Please sign in to comment.