diff --git a/src/env.cc b/src/env.cc index f298a7b1a61fe5..869a28af03bd09 100644 --- a/src/env.cc +++ b/src/env.cc @@ -701,6 +701,8 @@ void Environment::RunAndClearNativeImmediates(bool only_refed) { if (head->is_refed() || !only_refed) head->Call(this); + head.reset(); // Destroy now so that this is also observed by try_catch. + if (UNLIKELY(try_catch.HasCaught())) { if (!try_catch.HasTerminated() && can_call_into_js()) errors::TriggerUncaughtException(isolate(), try_catch);