-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
I got are crash reports from app.
code at : RCTImageLoader.m
// Download image
__weak __typeof(self) weakSelf = self;
RCTNetworkTask *task = [networking networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
if (error || !response || !data) {
NSError *someError = nil;
if (error) {
someError = error;
} else if (!response) {
someError = RCTErrorWithMessage(@"Response metadata error");
} else {
someError = RCTErrorWithMessage(@"Unknown image download error");
}
completionHandler(someError, nil);
[weakSelf dequeueTasks];
return;
}
dispatch_async(self->_URLCacheQueue, ^{ // **** Line 462 at here **** //
__typeof(self) strongSelf = self;
if (!strongSelf) {
return;
}
I see completionBlock method using the weakSelf itself, but I don't understand the block that doing cache the response nested in completionBlock why use this logic:
__typeof(self) strongSelf = self;
if (!strongSelf) {
return;
}the 'self' object in cache response block will be retain when the block occurs copy, it may be released ? why not using weakSelf instead of self write it like this:
__typeof(self) strongSelf = weakSelf;overminder
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
