-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
Open
Labels
node-apiIssues and PRs related to the Node-API.Issues and PRs related to the Node-API.
Description
It could be the case that the TSFN's context is needed in order to "clean up" data in the user-provided call_js callback.
Since the TSFN's user-provided finalizer is called prior to draining the queue, the finalizer may clean/delete the context, which would then be passed to the call_js_cb as an invalid pointer.
Lines 424 to 431 in ce72fcc
| void Finalize() { | |
| v8::HandleScope scope(env->isolate); | |
| if (finalize_cb) { | |
| CallbackScope cb_scope(this); | |
| env->CallFinalizer<false>(finalize_cb, finalize_data, context); | |
| } | |
| EmptyQueueAndDelete(); | |
| } |
Lines 297 to 302 in ce72fcc
| void EmptyQueueAndDelete() { | |
| for (; !queue.empty(); queue.pop()) { | |
| call_js_cb(nullptr, nullptr, context, queue.front()); | |
| } | |
| delete this; | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
node-apiIssues and PRs related to the Node-API.Issues and PRs related to the Node-API.
Type
Projects
Status
Has PR