From 915345bd012d1b256e80e77e4a1f959b536eb3e6 Mon Sep 17 00:00:00 2001 From: Roshan Jossey Date: Mon, 8 Aug 2016 15:53:53 -0700 Subject: [PATCH] Fix memory leak bug in RCTModalHost Summary: This PR addresses issue #9265. Negated the condition that checks if `_hostViews` exists so that `_hostViews` will be allocated only if it doesn't exist Closes https://github.com/facebook/react-native/pull/9295 Differential Revision: D3686214 fbshipit-source-id: ec0caac99d231786eefad023f3f0ed44a79f687e --- React/Views/RCTModalHostViewManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Views/RCTModalHostViewManager.m b/React/Views/RCTModalHostViewManager.m index b26a91206..a7227247d 100644 --- a/React/Views/RCTModalHostViewManager.m +++ b/React/Views/RCTModalHostViewManager.m @@ -42,7 +42,7 @@ RCT_EXPORT_MODULE() - (UIView *)view { UIView *view = [[RCTModalHostView alloc] initWithBridge:self.bridge]; - if (_hostViews) { + if (!_hostViews) { _hostViews = [NSHashTable weakObjectsHashTable]; } [_hostViews addObject:view];