From 02fd85a6ebe132a39f52d7d86a119fc9ef4698ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Mon, 14 Oct 2024 02:35:30 -0700 Subject: [PATCH] Fix race condition when reporting mounting transactions for deallocated surfaces (#47008) Summary: Changelog: [internal] This code is gated anyway so there's no harm in production. Reviewed By: javache Differential Revision: D64322331 --- .../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 "