Skip to content

Commit a79baf0

Browse files
trevnorrisMyles Borins
authored and
Myles Borins
committed
src: use global SealHandleScope
Helps to find Handle leaks in Debug mode. Ref: a5244d3 "deps: backport 1f8555 from v8's upstream" PR-URL: #3945 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: James Snell <jasnell@gmail.com>
1 parent 46c8e21 commit a79baf0

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/node.cc

+18-13
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ using v8::Number;
116116
using v8::Object;
117117
using v8::ObjectTemplate;
118118
using v8::PropertyCallbackInfo;
119+
using v8::SealHandleScope;
119120
using v8::String;
120121
using v8::TryCatch;
121122
using v8::Uint32;
@@ -3769,19 +3770,23 @@ int Start(int argc, char** argv) {
37693770
if (use_debug_agent)
37703771
EnableDebug(env);
37713772

3772-
bool more;
3773-
do {
3774-
more = uv_run(env->event_loop(), UV_RUN_ONCE);
3775-
if (more == false) {
3776-
EmitBeforeExit(env);
3777-
3778-
// Emit `beforeExit` if the loop became alive either after emitting
3779-
// event, or after running some callbacks.
3780-
more = uv_loop_alive(env->event_loop());
3781-
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
3782-
more = true;
3783-
}
3784-
} while (more == true);
3773+
{
3774+
SealHandleScope seal(node_isolate);
3775+
bool more;
3776+
do {
3777+
more = uv_run(env->event_loop(), UV_RUN_ONCE);
3778+
if (more == false) {
3779+
EmitBeforeExit(env);
3780+
3781+
// Emit `beforeExit` if the loop became alive either after emitting
3782+
// event, or after running some callbacks.
3783+
more = uv_loop_alive(env->event_loop());
3784+
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
3785+
more = true;
3786+
}
3787+
} while (more == true);
3788+
}
3789+
37853790
code = EmitExit(env);
37863791
RunAtExit(env);
37873792

0 commit comments

Comments
 (0)