From d8dd330d41a3f67c2e8b010f91fd4bb341200edf Mon Sep 17 00:00:00 2001 From: rocman Date: Thu, 5 Nov 2015 08:57:50 -0800 Subject: [PATCH] fix the memory leaks caused by RCTTabBar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: The memory leaks root from the TabBarController not removing itself when its holder view deallocs. So to fix the issue, it’s just to remove it from its parentViewController when the holding RCTTabBar deallocs. This should be safe, since the RCTTabBar seems the owner of the TabBarController. Closes https://github.com/facebook/react-native/pull/3915 Reviewed By: svcscm Differential Revision: D2620905 Pulled By: nicklockwood fb-gh-sync-id: ce22eb3ebf82562827f6b1bae22aea5ac7d3b51a --- React/Views/RCTTabBar.m | 1 + 1 file changed, 1 insertion(+) diff --git a/React/Views/RCTTabBar.m b/React/Views/RCTTabBar.m index 3b7b6693f..fee6d1a60 100644 --- a/React/Views/RCTTabBar.m +++ b/React/Views/RCTTabBar.m @@ -50,6 +50,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - (void)dealloc { _tabController.delegate = nil; + [_tabController removeFromParentViewController]; } - (NSArray *)reactSubviews