From b5271779ec7e5c2508096eb27d2b1fd361b96bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Mon, 14 Oct 2024 04:16:04 -0700 Subject: [PATCH] Fix race condition when reporting mounting transactions for deallocated surfaces (#47008) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47008 Changelog: [internal] This code is gated anyway so there's no harm in production. Reviewed By: javache Differential Revision: D64322331 fbshipit-source-id: 005eb385f7e5ccd3d33e2d8c28e45b84f1537d68 --- .../src/main/jni/react/fabric/FabricUIManagerBinding.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp index 2e2e50f315c3ad..76384785d33d2e 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp @@ -121,7 +121,10 @@ void FabricUIManagerBinding::reportMount(SurfaceId surfaceId) { } } if (surfaceHandler != nullptr) { - surfaceHandler->getMountingCoordinator()->didPerformAsyncTransactions(); + auto mountingCoordinator = surfaceHandler->getMountingCoordinator(); + if (mountingCoordinator != nullptr) { + mountingCoordinator->didPerformAsyncTransactions(); + } } } else { LOG(ERROR) << "FabricUIManagerBinding::reportMount: Surface with id "