fix(napi): require static lifetime on add_finalizer callback (#1968)

Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
Tom Barham 2024-02-22 20:40:04 +10:00 committed by GitHub
parent 5b5f616d81
commit ebd5eef267
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,7 +37,7 @@ impl JsObject {
where
T: 'static,
Hint: 'static,
F: FnOnce(FinalizeContext<T, Hint>),
F: FnOnce(FinalizeContext<T, Hint>) + 'static,
{
let mut maybe_ref = ptr::null_mut();
let wrap_context = Box::leak(Box::new((native, finalize_cb, ptr::null_mut())));