From eddefec5f8dc58a1ecf66944e36d8c780fac7064 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Wed, 13 Sep 2023 06:38:14 -0700 Subject: [PATCH] Fix race condition in Binding::reportMount (#39420) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39420 changelog: [internal] The intent of the code is to retain shared_ptr but by using a reference, it didn't do that. Leading to a race condition. bypass-github-export-checks Reviewed By: rubennorte Differential Revision: D49227147 fbshipit-source-id: 1a548f7174eacb95c14c89f72b51ccd263c5ab01 --- .../ReactAndroid/src/main/jni/react/fabric/Binding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp index e3c954552fb..9d979b95afe 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/Binding.cpp @@ -98,7 +98,7 @@ void Binding::driveCxxAnimations() { } void Binding::reportMount(SurfaceId surfaceId) { - const auto& scheduler = getScheduler(); + auto scheduler = getScheduler(); if (!scheduler) { LOG(ERROR) << "Binding::reportMount: scheduler disappeared"; return;