From 83f0210ceebe92a3d2267dcfffd532e2d7a7d4bd Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Tue, 19 Nov 2019 09:48:48 -0800 Subject: [PATCH] Fabric: Attempt to fix a crash in RCTMountingTransactionObserverCoordinator Summary: We see a quite small but probably dangerous crash in RCTMountingTransactionObserverCoordinator, it's unclear why exactly it happens but seems it's somehow connected with a shape of RCTComponentViewDescriptor struct. Specifying storage attribute (`__strong`) correctly/explicitly might fix the issue. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D18567763 fbshipit-source-id: 57d9f96c4609a38ddf44ce02df53f2d713dfb116 --- React/Fabric/Mounting/RCTComponentViewDescriptor.h | 2 +- React/Fabric/Mounting/RCTMountingManager.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/React/Fabric/Mounting/RCTComponentViewDescriptor.h b/React/Fabric/Mounting/RCTComponentViewDescriptor.h index 1642c2bc51d..b77f04d23cb 100644 --- a/React/Fabric/Mounting/RCTComponentViewDescriptor.h +++ b/React/Fabric/Mounting/RCTComponentViewDescriptor.h @@ -21,7 +21,7 @@ class RCTComponentViewDescriptor final { /* * Associated (and owned) native view instance. */ - UIView *view; + __strong UIView *view = nil; /* * Indicates a requirement to call on the view methods from diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index e0096438ff1..060eda9043c 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -46,7 +46,7 @@ static void RNDeleteMountInstruction( SurfaceId surfaceId) { auto const &oldChildShadowView = mutation.oldChildShadowView; - RCTComponentViewDescriptor componentViewDescriptor = [registry componentViewDescriptorWithTag:oldChildShadowView.tag]; + auto const &componentViewDescriptor = [registry componentViewDescriptorWithTag:oldChildShadowView.tag]; observerCoordinator.unregisterViewComponentDescriptor(componentViewDescriptor, surfaceId); [registry enqueueComponentViewWithComponentHandle:oldChildShadowView.componentHandle tag:oldChildShadowView.tag