-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
node-api: make napi_delete_reference use node_api_basic_env #59684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
82177ad
001894c
26c06d6
6a54a14
dde1ea8
f58f962
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ MyObject::MyObject(double value) | |
| : value_(value), env_(nullptr), wrapper_(nullptr) {} | ||
|
|
||
| MyObject::~MyObject() { | ||
| napi_delete_reference(env_, wrapper_); | ||
| napi_delete_reference(static_cast<node_api_basic_env>(env_), wrapper_); | ||
|
||
| } | ||
|
|
||
| void MyObject::Destructor(node_api_basic_env env, | ||
|
|
@@ -215,7 +215,9 @@ napi_value ObjectWrapDanglingReferenceTest(napi_env env, | |
|
|
||
| if (out == nullptr) { | ||
| // If the napi_ref has been invalidated, delete it. | ||
| NODE_API_CALL(env, napi_delete_reference(env, dangling_ref)); | ||
| NODE_API_CALL(env, | ||
| napi_delete_reference(static_cast<node_api_basic_env>(env), | ||
| dangling_ref)); | ||
| NODE_API_CALL(env, napi_get_boolean(env, true, &ret)); | ||
| } else { | ||
| // The dangling napi_ref is still valid. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,9 @@ static int finalize_count = 0; | |
|
|
||
| MyObject::MyObject() : env_(nullptr), wrapper_(nullptr) {} | ||
|
|
||
| MyObject::~MyObject() { napi_delete_reference(env_, wrapper_); } | ||
| MyObject::~MyObject() { | ||
|
||
| napi_delete_reference(static_cast<node_api_basic_env>(env_), wrapper_); | ||
| } | ||
|
|
||
| void MyObject::Destructor(napi_env env, | ||
| void* nativeObject, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this static_cast is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let me remove that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@legendecas I removed the static cast