Skip to content

Commit

Permalink
fix crash with async workers in napi addons
Browse files Browse the repository at this point in the history
  • Loading branch information
vektor committed Feb 28, 2025
1 parent 88b849f commit 94d9745
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions patches/async_addon.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git forkSrcPrefix/src/node_api.cc forkDstPrefix/src/node_api.cc
index a019a1826c6ce72a5f05d0bee01ece2089126b09..4694d3ad271a7a46e28f4c9bf4b8266bb0eca56e 100644
--- forkSrcPrefix/src/node_api.cc
+++ forkDstPrefix/src/node_api.cc
@@ -1201,7 +1201,7 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork {
// Establish a handle scope here so that every callback doesn't have to.
// Also it is needed for the exception-handling below.
v8::HandleScope scope(_env->isolate);
-
+ v8::Context::Scope context_scope(_env->context());
CallbackScope callback_scope(this);

_env->CallbackIntoModule<true>([&](napi_env env) {

0 comments on commit 94d9745

Please sign in to comment.