From 3f74f69cf00858cd18774837bf5afc3fccdfca86 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Thu, 23 May 2024 11:11:27 -0700 Subject: [PATCH] Fixes race condition of m_batchHadNativeModuleOrTurboModuleCalls (#44653) Summary: Fixes https://github.com/facebook/react-native/issues/44649. ## Changelog: [IOS] [FIXED] - Fixes race condition of m_batchHadNativeModuleOrTurboModuleCalls Pull Request resolved: https://github.com/facebook/react-native/pull/44653 Test Plan: Demo in https://github.com/facebook/react-native/issues/44649. Reviewed By: fabriziocucci Differential Revision: D57727886 Pulled By: sammy-SC fbshipit-source-id: 967e2d8452cc477f2225151a46e9aa27698f4506 --- packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp b/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp index aeec3b7a144..318a0ebbb9d 100644 --- a/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ b/packages/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp @@ -101,7 +101,7 @@ class JsToNativeBridge : public react::ExecutorDelegate { // executor is destroyed synchronously on its queue. std::shared_ptr m_registry; std::shared_ptr m_callback; - bool m_batchHadNativeModuleOrTurboModuleCalls = false; + std::atomic m_batchHadNativeModuleOrTurboModuleCalls{false}; }; NativeToJsBridge::NativeToJsBridge(