mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02: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:
parent
351a252db5
commit
e1c838e7aa
1 changed files with 4 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue