react-native/Libraries/Image
Adam Comella 23423774ba iOS: Fix an image loader crash
Summary:
Fixes #10433

The code didn't account for the fact that cancelLoad is set by two different threads. It gets set on the URL request queue when the request completes successfully and it gets set on the UI queue during cancelation. This oversight lead to a couple of different kinds of crashes.

1. Attempt to invoke a nil function -- We check that cancelLoad is non-nil and on the next line we call it. However, cancelLoad could have been set to nil by the other thread between the time it was verified to be non-nil and the time it was called. Consequently, the program will attempt to call nil and crash.

2. Block deallocated while it's executing -- Suppose cancelLoad points to a block, it is verified to be non-nil, and it is successfully invoked. In the middle of executing the block, cancelLoad, the last reference to the block, is set to nil. This causes the block to be deallocated and its captured values to be freed. However, the block continues executing and the next time it attempts to use a captured value
Closes https://github.com/facebook/react-native/pull/11145

Differential Revision: D4261499

Pulled By: javache

fbshipit-source-id: 46424c6dd8cfa085cef32d945308de07798040bc
2016-12-01 21:28:33 -08:00
..
RCTImage.xcodeproj Fix imports in UIExplorerUnitTests 2016-11-24 09:58:31 -08:00
__tests__ Update Jest APIs on fbsource 2016-04-27 19:16:32 -07:00
AssetRegistry.js [ReactNative] Teach flow how to deal with images 2015-08-26 18:26:09 -08:00
AssetSourceResolver.js RN: Cleanup OSS JS & Flow Declarations 2016-11-20 17:58:29 -08:00
Image.android.js Make resolveAssetSource public 2016-11-14 21:14:10 -08:00
Image.ios.js Improve doc code consistency 2016-11-16 18:13:26 -08:00
ImageEditor.js Auto-fix lint errors 2016-08-09 06:43:46 -07:00
ImageResizeMode.js Add Image resizeMode repeat on iOS 2016-06-22 04:28:44 -07:00
ImageSource.js Remove underline colour in Android text inputs 2016-11-04 14:58:46 -07:00
ImageSourcePropType.js RN: Stop Deep Linking `ReactPropTypes` 2016-10-14 18:59:10 -07:00
ImageStore.js Open sourced <ImageEditor>, <ImageStore> for Android 2016-01-27 10:50:54 -08:00
ImageStylePropTypes.js RN: Stop Deep Linking `ReactPropTypes` 2016-10-14 18:59:10 -07:00
RCTGIFImageDecoder.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTGIFImageDecoder.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageBlurUtils.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageBlurUtils.m Add blur effect to RCTImageView 2016-03-17 12:25:40 -07:00
RCTImageCache.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageCache.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageEditingManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageEditingManager.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageLoader.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageLoader.m iOS: Fix an image loader crash 2016-12-01 21:28:33 -08:00
RCTImageStoreManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageStoreManager.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageUtils.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageUtils.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageView.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageView.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageViewManager.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTImageViewManager.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTLocalAssetImageLoader.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTLocalAssetImageLoader.m Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTResizeMode.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTResizeMode.m Add Image resizeMode center to iOS 2016-07-19 03:43:26 -07:00
RelativeImageStub.js [ReactNative] Teach flow how to deal with images 2015-08-26 18:26:09 -08:00
nativeImageSource.js Add `deprecated` flag for nativeImageSource 2016-11-28 15:58:36 -08:00
resolveAssetSource.js Introduce custom asset resolver to resolveAssetSource(..) 2016-03-15 20:20:27 -07:00