From bf1b946b9a6762679ad3be860fc349df21279d2e Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Tue, 6 Nov 2012 09:17:44 +0100 Subject: [PATCH] Fix double call to NSURLConnection start + wrong condition for low priority (fix #212) --- SDWebImage/SDWebImageDownloaderOperation.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 3466b169..ec1373dc 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -56,16 +56,15 @@ dispatch_async(dispatch_get_main_queue(), ^ { - self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO]; - [self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; - [self.connection start]; self.executing = YES; + self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO]; // If not in low priority mode, ensure we aren't blocked by UI manipulations (default runloop mode for NSURLConnection is NSEventTrackingRunLoopMode) - if (self.options & SDWebImageDownloaderLowPriority) + if (!(self.options & SDWebImageDownloaderLowPriority)) { [self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; } + [self.connection start]; if (self.connection)