Skip to content

Commit

Permalink
LogBox - Deallocate _rootViewController to release surface reference …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
rickhanlonii authored and facebook-github-bot committed Feb 11, 2020
1 parent 7bd1abe commit 6ba2aee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion React/CoreModules/RCTLogBox.mm
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ - (void)dealloc

- (void)show
{
__weak __typeof(self) weakSelf = self;
[RCTSharedApplication().delegate.window.rootViewController presentViewController:_rootViewController animated:NO completion:^{
[self->_rootViewController.view becomeFirstResponder];
__strong __typeof(self) strongSelf = weakSelf;
if (strongSelf) {
[strongSelf->_rootViewController.view becomeFirstResponder];
}
}];
}

Expand Down

0 comments on commit 6ba2aee

Please sign in to comment.