From ac81869f05d74bccc79d78e738619cfc403db767 Mon Sep 17 00:00:00 2001 From: Danny Povolotski Date: Wed, 27 May 2026 05:59:18 -0700 Subject: [PATCH] Fix crash on reload (#56594) Summary: Revert crash on reload caused by https://github.com/facebook/react-native/commit/45b4817414928c9bfa0b055bb09533ac177cada6#diff-99e9fee4dbe9d329e2f7df16035fb871fa583c92028a48fefb1c48e405638944R314-R316 j-piasecki your change that seems redundant for the destructor case (reactInstanceData_ is a unique pointer and will be destroyed anyway) and breaks the reload case (by setting `contextContainer` to `nullptr`, which is then immediately accessed by `createReactInstance`, causing a crash) ## Changelog: [GENERAL] [FIXED] - Fixed a regression that causes crashes on reload for `ReactCxxPlatform`'s `ReactHost` Pull Request resolved: https://github.com/facebook/react-native/pull/56594 Test Plan: Reload the development server Reviewed By: cortinico Differential Revision: D106362104 Pulled By: javache fbshipit-source-id: 69c6a28b81c5fd55cc1f4bac29c177e70912fa1a --- .../react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp b/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp index 8c9e0f4987f..32281939c19 100644 --- a/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp +++ b/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp @@ -314,9 +314,6 @@ void ReactHost::destroyReactInstance() { reactInstanceData_->contextContainer->erase(RuntimeSchedulerKey); reactInstanceData_->mountingManager->setSchedulerTaskExecutor(nullptr); - reactInstanceData_->mountingManager = nullptr; - reactInstanceData_->contextContainer = nullptr; - reactInstanceData_->turboModuleProviders.clear(); reactInstance_ = nullptr; reactInstanceData_->messageQueueThread = nullptr; }