Skip to content

Commit 1aa74cc

Browse files
ryzokukenjasnell
authored andcommitted
src: move v8::HandleScope call to Emit
Move v8::HandleScope call to Emit removing it from previous locations where it was added to avoid crashing (constructor and destructor of AsyncWrap) for a more general and fool-proof solution. Ref: #19972 (comment) PR-URL: #20045 Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent 193d808 commit 1aa74cc

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/async_wrap-inl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,13 @@ inline AsyncWrap::AsyncScope::AsyncScope(AsyncWrap* wrap)
5050
Environment* env = wrap->env();
5151
if (env->async_hooks()->fields()[Environment::AsyncHooks::kBefore] == 0)
5252
return;
53-
v8::HandleScope handle_scope(env->isolate());
5453
EmitBefore(env, wrap->get_async_id());
5554
}
5655

5756
inline AsyncWrap::AsyncScope::~AsyncScope() {
5857
Environment* env = wrap_->env();
5958
if (env->async_hooks()->fields()[Environment::AsyncHooks::kAfter] == 0)
6059
return;
61-
v8::HandleScope handle_scope(env->isolate());
6260
EmitAfter(env, wrap_->get_async_id());
6361
}
6462

src/async_wrap.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ void Emit(Environment* env, double async_id, AsyncHooks::Fields type,
169169
if (async_hooks->fields()[type] == 0)
170170
return;
171171

172+
v8::HandleScope handle_scope(env->isolate());
172173
Local<Value> async_id_value = Number::New(env->isolate(), async_id);
173174
FatalTryCatch try_catch(env);
174175
USE(fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value));

0 commit comments

Comments
 (0)