From a8fca6584feabd625abdcbc0da921cbfc689fa3e Mon Sep 17 00:00:00 2001 From: Bogdan Poplauschi Date: Tue, 19 Jan 2016 19:08:18 +0200 Subject: [PATCH] Continuation of Fix #1366, addresses #1350 and reverts a part of #1221 - from commit 6406d8e, the wrong usage of dispatch_apply This one fixes: #1425 and #1426 --- SDWebImage/SDWebImagePrefetcher.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImagePrefetcher.m b/SDWebImage/SDWebImagePrefetcher.m index 531101ae..f518d441 100644 --- a/SDWebImage/SDWebImagePrefetcher.m +++ b/SDWebImage/SDWebImagePrefetcher.m @@ -80,7 +80,11 @@ totalCount:self.prefetchURLs.count ]; } - else if (self.finishedCount == self.requestedCount) { + if (self.prefetchURLs.count > self.requestedCount) { + dispatch_async(self.prefetcherQueue, ^{ + [self startPrefetchingAtIndex:self.requestedCount]; + }); + } else if (self.finishedCount == self.requestedCount) { [self reportStatus]; if (self.completionBlock) { self.completionBlock(self.finishedCount, self.skippedCount);