Fix the missing lock for callbackTokens which may cause thread-safe issue
This commit is contained in:
parent
bc3f09ccbd
commit
384b2d7c8b
|
@ -244,7 +244,10 @@
|
||||||
self.coderQueue.qualityOfService = NSQualityOfServiceDefault;
|
self.coderQueue.qualityOfService = NSQualityOfServiceDefault;
|
||||||
}
|
}
|
||||||
[self.dataTask resume];
|
[self.dataTask resume];
|
||||||
NSArray<SDWebImageDownloaderOperationToken *> *tokens = [self.callbackTokens copy];
|
NSArray<SDWebImageDownloaderOperationToken *> *tokens;
|
||||||
|
@synchronized (self) {
|
||||||
|
tokens = [self.callbackTokens copy];
|
||||||
|
}
|
||||||
for (SDWebImageDownloaderOperationToken *token in tokens) {
|
for (SDWebImageDownloaderOperationToken *token in tokens) {
|
||||||
if (token.progressBlock) {
|
if (token.progressBlock) {
|
||||||
token.progressBlock(0, NSURLResponseUnknownLength, self.request.URL);
|
token.progressBlock(0, NSURLResponseUnknownLength, self.request.URL);
|
||||||
|
|
Loading…
Reference in New Issue