mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
test: check napi_get_reference_value() during finalization
PR-URL: https://github.com/nodejs/node/pull/27470 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
351a252db5
commit
e1c838e7aa
1 file changed
+4
@@ -1,4 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <js_native_api.h>
|
||||
#include "../common.h"
|
||||
|
||||
@@ -135,6 +136,9 @@ static napi_value GetReferenceValue(napi_env env, napi_callback_info info) {
|
||||
static void DeleteBeforeFinalizeFinalizer(
|
||||
napi_env env, void* finalize_data, void* finalize_hint) {
|
||||
napi_ref* ref = (napi_ref*)finalize_data;
|
||||
napi_value value;
|
||||
assert(napi_get_reference_value(env, *ref, &value) == napi_ok);
|
||||
assert(value == NULL);
|
||||
napi_delete_reference(env, *ref);
|
||||
free(ref);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user