Skip to content

Commit 94d9745

Browse files
author
vektor
committed
fix crash with async workers in napi addons
1 parent 88b849f commit 94d9745

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

patches/async_addon.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git forkSrcPrefix/src/node_api.cc forkDstPrefix/src/node_api.cc
2+
index a019a1826c6ce72a5f05d0bee01ece2089126b09..4694d3ad271a7a46e28f4c9bf4b8266bb0eca56e 100644
3+
--- forkSrcPrefix/src/node_api.cc
4+
+++ forkDstPrefix/src/node_api.cc
5+
@@ -1201,7 +1201,7 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork {
6+
// Establish a handle scope here so that every callback doesn't have to.
7+
// Also it is needed for the exception-handling below.
8+
v8::HandleScope scope(_env->isolate);
9+
-
10+
+ v8::Context::Scope context_scope(_env->context());
11+
CallbackScope callback_scope(this);
12+
13+
_env->CallbackIntoModule<true>([&](napi_env env) {

0 commit comments

Comments
 (0)