Skip to content

Commit

Permalink
Use strong reference in RCTImageLoader
Browse files Browse the repository at this point in the history
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 #10147

Differential Revision: D3938763

fbshipit-source-id: 7389d4ae7a98926014401a1fe0cbbdcdd5ee6a01
  • Loading branch information
pfeiffer authored and Facebook Github Bot committed Sep 28, 2016
1 parent c43a3f5 commit b2dac83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Image/RCTImageLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ - (RCTImageLoaderCancellationBlock)loadImageWithURLRequest:(NSURLRequest *)image
completionBlock(error_, image);
};

cancelLoad = [weakSelf decodeImageData:imageOrData
cancelLoad = [strongSelf decodeImageData:imageOrData
size:size
scale:scale
clipped:clipped
Expand Down

0 comments on commit b2dac83

Please sign in to comment.