From 80e31b3e6446aa045f71f7c053a5c8bf4c4d12b0 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Wed, 11 Dec 2024 17:29:02 +0800 Subject: [PATCH] [iOS] Fabric: Fixes assert failure when surface stop before we start surface --- .../react/runtime/platform/ios/ReactCommon/RCTHost.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm index b796713ed0670a..c6d129e54c7370 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm @@ -254,7 +254,8 @@ - (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName surface.surfaceHandler.setDisplayMode(displayMode); [self _attachSurface:surface]; - [_instance callFunctionOnBufferedRuntimeExecutor:[surface](facebook::jsi::Runtime &_) { [surface start]; }]; + __weak RCTFabricSurface *weakSurface = surface; + [_instance callFunctionOnBufferedRuntimeExecutor:[weakSurface](facebook::jsi::Runtime &_) { [weakSurface start]; }]; return surface; }