From d2a492a2d0444594b585353345f439e8802a5dd6 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 29 Dec 2022 14:27:33 +0800 Subject: [PATCH 1/2] fix(napi): require higher version of once_cell --- crates/napi/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/napi/Cargo.toml b/crates/napi/Cargo.toml index 1a5d88fe..87dd7e5e 100644 --- a/crates/napi/Cargo.toml +++ b/crates/napi/Cargo.toml @@ -50,7 +50,7 @@ tokio_time = ["tokio/time"] [dependencies] ctor = "0.1" -once_cell = "1" +once_cell = "1.16" thread_local = "1" bitflags = "1" From 877d631d99a89205d7a6e711e58240746ca5bbf3 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 29 Dec 2022 14:48:00 +0800 Subject: [PATCH 2/2] fix(napi): only delete reference in custom gc --- crates/napi/src/bindgen_runtime/module_register.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/crates/napi/src/bindgen_runtime/module_register.rs b/crates/napi/src/bindgen_runtime/module_register.rs index 306bd239..f66ae1cc 100644 --- a/crates/napi/src/bindgen_runtime/module_register.rs +++ b/crates/napi/src/bindgen_runtime/module_register.rs @@ -598,12 +598,6 @@ extern "C" fn custom_gc( _context: *mut std::ffi::c_void, data: *mut std::ffi::c_void, ) { - let mut ref_count = 0; - check_status_or_throw!( - env, - unsafe { sys::napi_reference_unref(env, data as sys::napi_ref, &mut ref_count) }, - "Failed to unref Buffer reference in Custom GC" - ); check_status_or_throw!( env, unsafe { sys::napi_delete_reference(env, data as sys::napi_ref) },