Skip to content

Commit 7f571ba

Browse files
committed
Fixup2
1 parent ec1c853 commit 7f571ba

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/env.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,16 @@ 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() ?
1058+
Object::New(isolate_) :
1059+
Local<Object>();
1060+
InternalCallbackScope cb_scope(this, obj, { 0, 0 });
10561061

10571062
size_t ref_count = 0;
10581063

0 commit comments

Comments
 (0)