Skip to content

Commit a07c691

Browse files
committed
src: use global SealHandleScope
Helps to find Handle leaks in Debug mode. PR-URL: #1395 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent a5244d3 commit a07c691

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/node.cc

+18-14
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ using v8::ObjectTemplate;
101101
using v8::Promise;
102102
using v8::PromiseRejectMessage;
103103
using v8::PropertyCallbackInfo;
104+
using v8::SealHandleScope;
104105
using v8::String;
105106
using v8::TryCatch;
106107
using v8::Uint32;
@@ -3836,22 +3837,25 @@ static void StartNodeInstance(void* arg) {
38363837
if (instance_data->use_debug_agent())
38373838
EnableDebug(env);
38383839

3839-
bool more;
3840-
do {
3841-
v8::platform::PumpMessageLoop(default_platform, isolate);
3842-
more = uv_run(env->event_loop(), UV_RUN_ONCE);
3843-
3844-
if (more == false) {
3840+
{
3841+
SealHandleScope seal(isolate);
3842+
bool more;
3843+
do {
38453844
v8::platform::PumpMessageLoop(default_platform, isolate);
3846-
EmitBeforeExit(env);
3845+
more = uv_run(env->event_loop(), UV_RUN_ONCE);
38473846

3848-
// Emit `beforeExit` if the loop became alive either after emitting
3849-
// event, or after running some callbacks.
3850-
more = uv_loop_alive(env->event_loop());
3851-
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
3852-
more = true;
3853-
}
3854-
} while (more == true);
3847+
if (more == false) {
3848+
v8::platform::PumpMessageLoop(default_platform, isolate);
3849+
EmitBeforeExit(env);
3850+
3851+
// Emit `beforeExit` if the loop became alive either after emitting
3852+
// event, or after running some callbacks.
3853+
more = uv_loop_alive(env->event_loop());
3854+
if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
3855+
more = true;
3856+
}
3857+
} while (more == true);
3858+
}
38553859

38563860
int exit_code = EmitExit(env);
38573861
if (instance_data->is_main())

0 commit comments

Comments
 (0)