Skip to content

Commit 6ba2aee

Browse files
rickhanloniifacebook-github-bot
authored andcommitted
LogBox - Deallocate _rootViewController to release surface reference and break cycle
Summary: This def breaks a reference cycle in logbox causing a memory leak in development. Changelog: [iOS] [Fix] LogBox - Fix dependency cycle Reviewed By: PeteTheHeat Differential Revision: D19768068 fbshipit-source-id: 518b9c66499aa092465a9213f955965bffeebd88
1 parent 7bd1abe commit 6ba2aee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

React/CoreModules/RCTLogBox.mm

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ - (void)dealloc
7070

7171
- (void)show
7272
{
73+
__weak __typeof(self) weakSelf = self;
7374
[RCTSharedApplication().delegate.window.rootViewController presentViewController:_rootViewController animated:NO completion:^{
74-
[self->_rootViewController.view becomeFirstResponder];
75+
__strong __typeof(self) strongSelf = weakSelf;
76+
if (strongSelf) {
77+
[strongSelf->_rootViewController.view becomeFirstResponder];
78+
}
7579
}];
7680
}
7781

0 commit comments

Comments
 (0)