Skip to content

Commit

Permalink
src: use global SealHandleScope
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
trevnorris committed Nov 24, 2015
1 parent a042e41 commit f21212a
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ using v8::Number;
using v8::Object;
using v8::ObjectTemplate;
using v8::PropertyCallbackInfo;
using v8::SealHandleScope;
using v8::String;
using v8::TryCatch;
using v8::Uint32;
Expand Down Expand Up @@ -3755,19 +3756,23 @@ int Start(int argc, char** argv) {
if (use_debug_agent)
EnableDebug(env);

bool more;
do {
more = uv_run(env->event_loop(), UV_RUN_ONCE);
if (more == false) {
EmitBeforeExit(env);

// Emit `beforeExit` if the loop became alive either after emitting
// event, or after running some callbacks.
more = uv_loop_alive(env->event_loop());
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
more = true;
}
} while (more == true);
{
SealHandleScope seal(node_isolate);
bool more;
do {
more = uv_run(env->event_loop(), UV_RUN_ONCE);
if (more == false) {
EmitBeforeExit(env);

// Emit `beforeExit` if the loop became alive either after emitting
// event, or after running some callbacks.
more = uv_loop_alive(env->event_loop());
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
more = true;
}
} while (more == true);
}

code = EmitExit(env);
RunAtExit(env);

Expand Down

0 comments on commit f21212a

Please sign in to comment.