Skip to content

Commit 6eacee5

Browse files
committed
Fixup2
1 parent ec1c853 commit 6eacee5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/env.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,14 @@ void Environment::RunAndClearInterrupts() {
10481048
void Environment::RunAndClearNativeImmediates(bool only_refed) {
10491049
TRACE_EVENT0(TRACING_CATEGORY_NODE1(environment),
10501050
"RunAndClearNativeImmediates");
1051-
if (isolate_->IsExecutionTerminating())
1052-
return;
10531051

10541052
HandleScope handle_scope(isolate_);
1055-
InternalCallbackScope cb_scope(this, Object::New(isolate_), { 0, 0 });
1053+
// In case the Isolate is no longer accessible just use an empty Local. This
1054+
// is not an issue for InternalCallbackScope as this case is already handled
1055+
// in its constructor but we avoid calls into v8 which can crash the process
1056+
// in debug builds.
1057+
Local<Object> obj = can_call_into_js() ? Object::New(isolate_) : Local<Object>();
1058+
InternalCallbackScope cb_scope(this, obj, { 0, 0 });
10561059

10571060
size_t ref_count = 0;
10581061

0 commit comments

Comments
 (0)