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
This commit is contained in:
Danny Povolotski authored and meta-codesync[bot] committed 2026-05-27 05:59:18 -07:00
1 parent b8bb88d175
commit ac81869f05
1 file changed
-3
@@ -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;
}