diff options
author | haturau <135221985+haturatu@users.noreply.github.com> | 2024-11-20 01:20:47 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 01:20:47 +0900 |
commit | 85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch) | |
tree | face0aecaac53e93ce2f23b53c48859bcf1a36ec /tests/napi/src/tsfn.rs | |
parent | 67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff) | |
parent | 186b52731c6bb326c4d32905c5e732d082e83465 (diff) |
Merge branch 'denoland:main' into main
Diffstat (limited to 'tests/napi/src/tsfn.rs')
-rw-r--r-- | tests/napi/src/tsfn.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/napi/src/tsfn.rs b/tests/napi/src/tsfn.rs index dabc96f83..a3a231cec 100644 --- a/tests/napi/src/tsfn.rs +++ b/tests/napi/src/tsfn.rs @@ -46,6 +46,7 @@ fn create_custom_gc(env: sys::napi_env) { "Create async resource string in napi_register_module_v1 napi_register_module_v1" ); let mut custom_gc_tsfn = ptr::null_mut(); + let context = Box::into_raw(Box::new(0)) as *mut c_void; check_status_or_panic!( unsafe { sys::napi_create_threadsafe_function( @@ -57,7 +58,7 @@ fn create_custom_gc(env: sys::napi_env) { 1, ptr::null_mut(), Some(custom_gc_finalize), - ptr::null_mut(), + context, Some(custom_gc), &mut custom_gc_tsfn, ) @@ -80,8 +81,9 @@ unsafe extern "C" fn empty( unsafe extern "C" fn custom_gc_finalize( _env: sys::napi_env, _finalize_data: *mut c_void, - _finalize_hint: *mut c_void, + finalize_hint: *mut c_void, ) { + let _ = Box::from_raw(finalize_hint as *mut i32); } extern "C" fn custom_gc( |