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.
|
void Finalize() { |
|
v8::HandleScope scope(env->isolate); |
|
if (finalize_cb) { |
|
CallbackScope cb_scope(this); |
|
env->CallFinalizer<false>(finalize_cb, finalize_data, context); |
|
} |
|
EmptyQueueAndDelete(); |
|
} |
|
void EmptyQueueAndDelete() { |
|
for (; !queue.empty(); queue.pop()) { |
|
call_js_cb(nullptr, nullptr, context, queue.front()); |
|
} |
|
delete this; |
|
} |
It could be the case that the TSFN's
contextis needed in order to "clean up" data in the user-providedcall_jscallback.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.
node/src/node_api.cc
Lines 424 to 431 in ce72fcc
node/src/node_api.cc
Lines 297 to 302 in ce72fcc