From 2e4f7659327b69b74e20af59b6d5e65c699b6adb Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Mon, 24 Jan 2022 12:21:24 -0500 Subject: [PATCH] tweak: drop hooks before resetting bump arena --- packages/core/src/scopes.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/scopes.rs b/packages/core/src/scopes.rs index 4eda40c50..c54918b55 100644 --- a/packages/core/src/scopes.rs +++ b/packages/core/src/scopes.rs @@ -891,13 +891,15 @@ impl ScopeState { self.frames[0].reset(); self.frames[1].reset(); - // Finally, free up the hook values - self.hook_arena.reset(); + // Free up the hook values self.hook_vals.get_mut().drain(..).for_each(|state| { let as_mut = unsafe { &mut *state }; let boxed = unsafe { bumpalo::boxed::Box::from_raw(as_mut) }; drop(boxed); }); + + // Finally, clear the hook arena + self.hook_arena.reset(); } }