diff --git a/packages/core/src/nodes.rs b/packages/core/src/nodes.rs index f71e41fc5..803f05b41 100644 --- a/packages/core/src/nodes.rs +++ b/packages/core/src/nodes.rs @@ -157,7 +157,7 @@ impl Drop for VNode { for attrs in self.vnode.dynamic_attrs.iter() { for attr in attrs.iter() { if let AttributeValue::Listener(listener) = &attr.value { - listener.callback.manually_drop(); + listener.callback.recycle(); } } } diff --git a/packages/generational-box/src/lib.rs b/packages/generational-box/src/lib.rs index d6111d9af..505ef6ae9 100644 --- a/packages/generational-box/src/lib.rs +++ b/packages/generational-box/src/lib.rs @@ -198,12 +198,17 @@ impl> GenerationalBox { } } - /// Drop the value out of the generational box and invalidate the generational box. This will return the value if the value was taken. + /// Recycle the generationalbox, dropping the value. + pub fn recycle(&self) { + _ = Storage::take(&self.raw.0.data); + ::recycle(&self.raw); + } + + /// Drop the value out of the generational box and invalidate the generational box. + /// This will return the value if the value was taken. pub fn manually_drop(&self) -> Option { if self.validate() { - let o = Storage::take(&self.raw.0.data); - ::recycle(&self.raw); - o + Storage::take(&self.raw.0.data) } else { None }