Use strong reference in RCTImageLoader

Summary:
This PR is related to the multitude of crashes (#10016, #9751, #9882).

From my understanding, we should be using a strong reference when calling `decodeImageData` or we could be calling the method on a deallocated instance.

PR #9751 have mitigated this by adding a fail-safe, but I think the culprint is the weak reference, which this PR fixes.

Tested on iOS only, since it doesn't touch Android.
Closes https://github.com/facebook/react-native/pull/10147

Differential Revision: D3938763

fbshipit-source-id: 7389d4ae7a98926014401a1fe0cbbdcdd5ee6a01
This commit is contained in:
Mattias Pfeiffer 2016-09-28 13:26:16 -07:00 committed by Facebook Github Bot
parent c43a3f5d84
commit b2dac834fb
1 changed files with 1 additions and 1 deletions

View File

@ -553,7 +553,7 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
completionBlock(error_, image);
};
cancelLoad = [weakSelf decodeImageData:imageOrData
cancelLoad = [strongSelf decodeImageData:imageOrData
size:size
scale:scale
clipped:clipped