diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index 6e86ea7b5f3..ad4489c10bc 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -125,6 +125,12 @@ impl UniqueArc { .unwrap_or_else(|| alloc::handle_alloc_error(layout)) .cast::>>(); ptr::write(&mut p.as_mut().count, atomic::AtomicUsize::new(1)); + + #[cfg(feature = "gecko_refcount_logging")] + { + NS_LogCtor(p.as_ptr() as *mut _, b"ServoArc\0".as_ptr() as *const _, 8) + } + UniqueArc(Arc { p, phantom: PhantomData, @@ -144,7 +150,7 @@ impl UniqueArc> { #[inline] pub unsafe fn assume_init(this: Self) -> UniqueArc { UniqueArc(Arc { - p: this.0.p.cast(), + p: mem::ManuallyDrop::new(this).0.p.cast(), phantom: PhantomData, }) }