From af4eac574b26aa944d61ed703cb8d8d3bee49155 Mon Sep 17 00:00:00 2001 From: Jeetu Suthar <129197623+JeetuSuthar@users.noreply.github.com> Date: Fri, 12 Sep 2025 21:28:57 +0530 Subject: [PATCH] node-api: make napi_delete_reference use node_api_basic_env PR-URL: https://github.com/nodejs/node/pull/59684 Refs: https://github.com/nodejs/node/issues/59583 Reviewed-By: Chengzhong Wu Reviewed-By: Vladimir Morozov --- src/js_native_api.h | 2 +- src/js_native_api_v8.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js_native_api.h b/src/js_native_api.h index 8177ace3acb..6b53a2c28de 100644 --- a/src/js_native_api.h +++ b/src/js_native_api.h @@ -364,7 +364,7 @@ napi_create_reference(napi_env env, // Deletes a reference. The referenced value is released, and may // be GC'd unless there are other references to it. -NAPI_EXTERN napi_status NAPI_CDECL napi_delete_reference(napi_env env, +NAPI_EXTERN napi_status NAPI_CDECL napi_delete_reference(node_api_basic_env env, napi_ref ref); // Increments the reference count, optionally returning the resulting count. diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 260a572ce71..6dfcd534799 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -2773,7 +2773,8 @@ napi_status NAPI_CDECL napi_create_reference(napi_env env, // there are other references to it. // For a napi_reference returned from `napi_wrap`, this must be called in the // finalizer. -napi_status NAPI_CDECL napi_delete_reference(napi_env env, napi_ref ref) { +napi_status NAPI_CDECL napi_delete_reference(node_api_basic_env env, + napi_ref ref) { // Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw // JS exceptions. CHECK_ENV(env);