diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index f4b13868..e38eb79b 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -91,7 +91,7 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - dispatch_release(_ioQueue); + SDDispatchQueueRelease(_ioQueue); } #pragma mark SDImageCache (private) diff --git a/SDWebImage/SDWebImageCompat.h b/SDWebImage/SDWebImageCompat.h index 7ce114af..7dc92cfc 100644 --- a/SDWebImage/SDWebImageCompat.h +++ b/SDWebImage/SDWebImageCompat.h @@ -33,6 +33,19 @@ #import #endif +// @see https://github.com/ccgus/fmdb/commit/aef763eeb64e6fa654e7d121f1df4c16a98d9f4f +#define SDDispatchQueueRelease(q) (dispatch_release(q)) + +#if TARGET_OS_IPHONE + #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 + #define SDDispatchQueueRelease(q) + #endif +#else + #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 + #define SDDispatchQueueRelease(q) + #endif +#endif + NS_INLINE UIImage *SDScaledImageForPath(NSString *path, NSObject *imageOrData) { if (!imageOrData) diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index b29e5b14..e98965c7 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -77,8 +77,8 @@ NSString *const kCompletedCallbackKey = @"completed"; - (void)dealloc { [self.downloadQueue cancelAllOperations]; - dispatch_release(_workingQueue); - dispatch_release(_barrierQueue); + SDDispatchQueueRelease(_workingQueue); + SDDispatchQueueRelease(_barrierQueue); } - (void)setMaxConcurrentDownloads:(NSInteger)maxConcurrentDownloads