Skip to content

Commit c108341

Browse files
tobycoxpfeiffer
authored andcommitted
FIX facebook#9751 - Cancelling offscreen image loads causing crashes
Summary: This fixes facebook#9751 We were seeing the same issues as the original reporter. I'm not an expert on this code, so apologies if it's naive, but we haven't seen the crash since making this change. From my understanding of it, it seems like the `cancelLoad` block was being released before the block returned by `_loadImageOrDataWithURLRequest:` was called. This PR checks the `cancelled` flag before calling `cancelLoad()`. Closes facebook#10016 Differential Revision: D3902723 Pulled By: javache fbshipit-source-id: 75cd115e28694105c6fc29469986998ca0d4cd09
1 parent d42f186 commit c108341

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/Image/RCTImageLoader.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ - (RCTImageLoaderCancellationBlock)_loadImageOrDataWithURLRequest:(NSURLRequest
378378
});
379379

380380
return ^{
381-
if (cancelLoad) {
381+
if (cancelLoad && !cancelled) {
382382
cancelLoad();
383383
cancelLoad = nil;
384384
}

0 commit comments

Comments
 (0)