From ebd5eef26769467ee07670ade061e572294ba4a6 Mon Sep 17 00:00:00 2001 From: Tom Barham <101230539+tomb-msft@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:40:04 +1000 Subject: [PATCH] fix(napi): require static lifetime on add_finalizer callback (#1968) Co-authored-by: LongYinan --- crates/napi/src/js_values/object.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/napi/src/js_values/object.rs b/crates/napi/src/js_values/object.rs index 20acd658..77507f00 100644 --- a/crates/napi/src/js_values/object.rs +++ b/crates/napi/src/js_values/object.rs @@ -37,7 +37,7 @@ impl JsObject { where T: 'static, Hint: 'static, - F: FnOnce(FinalizeContext), + F: FnOnce(FinalizeContext) + 'static, { let mut maybe_ref = ptr::null_mut(); let wrap_context = Box::leak(Box::new((native, finalize_cb, ptr::null_mut())));