From f827a513a1a312a9d7b2f056cd025f9621426fff Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Mon, 23 Nov 2015 04:18:20 -0800 Subject: [PATCH] Fixed double-callback for cached images Summary: public A missing return statement in RCTImageLoader meant that cached images would be loaded twice - once from cache and again from the source. This was mostly innocuous, causing only a slight perf regression due to the image cache being effectively disabled, however in some cases (such as RCTImageEditingManager.cropImage) it caused the success callback to fire twice, resulting in a crash. Reviewed By: fkgozali Differential Revision: D2684956 fb-gh-sync-id: 7580a6fbfe00a30807951803e04bfcdbee3bb80a --- Libraries/Image/RCTImageLoader.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Libraries/Image/RCTImageLoader.m b/Libraries/Image/RCTImageLoader.m index 8c77828b0..7f67b53b7 100644 --- a/Libraries/Image/RCTImageLoader.m +++ b/Libraries/Image/RCTImageLoader.m @@ -290,6 +290,7 @@ RCT_EXPORT_MODULE() NSCachedURLResponse *cachedResponse = [_URLCache cachedResponseForRequest:request]; if (cachedResponse) { processResponse(cachedResponse.response, cachedResponse.data, nil); + return; } // Download image