diff --git a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp index 8ae8766f5e3e84..58b56e83f0cc45 100644 --- a/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +++ b/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp @@ -43,13 +43,16 @@ class HermesExecutorRuntimeAdapter } void tickleJs() override { - // The queue will ensure that runtime_ is still valid when this - // gets invoked. - thread_->runOnQueue([&runtime = runtime_]() { - auto func = - runtime->global().getPropertyAsFunction(*runtime, "__tickleJs"); - func.call(*runtime); - }); + thread_->runOnQueue( + [weakRuntime = std::weak_ptr(runtime_)]() { + auto runtime = weakRuntime.lock(); + if (!runtime) { + return; + } + jsi::Function func = + runtime->global().getPropertyAsFunction(*runtime, "__tickleJs"); + func.call(*runtime); + }); } private: