Skip to content

Commit

Permalink
Fix retain cycle in RCTFabricSurface
Browse files Browse the repository at this point in the history
Summary:
Changelog: [internal]

Fix retain cycle caused by chain: `RCTSurfaceTouchHandler` -> `RCTSurfaceTouchHandler._rootComponentView` -> `RCTSurfaceTouchHandler`

`RCTSurfaceTouchHandler._rootComponentView` calls `addGestureRecognizer` with `RCTSurfaceTouchHandler` as a parameter which, according to documentation, strongly holds onto gesture recogniser.

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/React/Fabric/RCTSurfaceTouchHandler.mm?lines=189

For details about `addGestureRecognizer`, refer to https://developer.apple.com/documentation/appkit/nsview/1483749-addgesturerecognizer?language=objc#

Reviewed By: shergin

Differential Revision: D23704441

fbshipit-source-id: b1ab0feff552eaf10c1c71a931690c5258ce87cf
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Sep 16, 2020
1 parent 635ac1b commit b705eaf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions React/Fabric/Surface/RCTFabricSurface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ - (BOOL)stop
}

[_surfacePresenter unregisterSurface:self];
[_touchHandler detachFromView:_view];
return YES;
}

Expand Down

0 comments on commit b705eaf

Please sign in to comment.