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<Scheduler> 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
This commit is contained in:
Samuel Susla
2023-09-13 06:38:14 -07:00
committed by Facebook GitHub Bot
parent ef438464fa
commit eddefec5f8
@@ -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;