Merge pull request #1849 from GibaPadavan/fix_autorelease_pool

[bugfix] Added @autoreleasepool to SDImageCache.storeImage
This commit is contained in:
Bogdan Poplauschi 2017-05-03 10:37:55 +03:00 committed by GitHub
commit 9231d6d500
1 changed files with 7 additions and 6 deletions

View File

@ -217,14 +217,15 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
if (toDisk) {
dispatch_async(self.ioQueue, ^{
NSData *data = imageData;
if (!data && image) {
SDImageFormat imageFormatFromData = [NSData sd_imageFormatForImageData:data];
data = [image sd_imageDataAsFormat:imageFormatFromData];
@autoreleasepool {
NSData *data = imageData;
if (!data && image) {
SDImageFormat imageFormatFromData = [NSData sd_imageFormatForImageData:data];
data = [image sd_imageDataAsFormat:imageFormatFromData];
}
[self storeImageDataToDisk:data forKey:key];
}
[self storeImageDataToDisk:data forKey:key];
if (completionBlock) {
dispatch_async(dispatch_get_main_queue(), ^{
completionBlock();