From 58c58d9bed67c329a719599571367d98db4b3b20 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Mon, 15 Jun 2015 11:23:30 -0700 Subject: [PATCH] [ReactNative] Fix racing condition on RKHTTPRequestHandler --- Libraries/Network/RCTDataManager.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/Network/RCTDataManager.m b/Libraries/Network/RCTDataManager.m index ed2c560d8..49ce6d754 100644 --- a/Libraries/Network/RCTDataManager.m +++ b/Libraries/Network/RCTDataManager.m @@ -134,12 +134,12 @@ typedef void (^RCTHTTPQueryResult)(NSError *error, NSDictionary *result); @implementation RCTActiveURLRequest -- (void)setResponse:(NSURLResponse *)response; +- (instancetype)init { - _response = response; - if (!_incrementalUpdates) { - _data = [[NSMutableData alloc] initWithCapacity:(NSUInteger)MAX(0, response.expectedContentLength)]; + if ((self = [super init])) { + _data = [[NSMutableData alloc] init]; } + return self; } @end