From a3f5647517188283a88ff923c1f1be64c7328604 Mon Sep 17 00:00:00 2001 From: Kinarobin Date: Thu, 7 Oct 2021 10:20:00 +0800 Subject: [PATCH] Revert "Fix image source release in iOS 15" --- SDWebImage/Core/SDImageIOAnimatedCoder.m | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/SDWebImage/Core/SDImageIOAnimatedCoder.m b/SDWebImage/Core/SDImageIOAnimatedCoder.m index d4d739ec..a7e08c19 100644 --- a/SDWebImage/Core/SDImageIOAnimatedCoder.m +++ b/SDWebImage/Core/SDImageIOAnimatedCoder.m @@ -437,14 +437,7 @@ static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestination if (scaleFactor != nil) { scale = MAX([scaleFactor doubleValue], 1); } - CGImageSourceRef imageSource = _imageSource; - if (imageSource != NULL) { - CFRetain(imageSource); - } else { - return nil; - } - image = [self.class createFrameAtIndex:0 source:imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil]; - CFRelease(imageSource); + image = [self.class createFrameAtIndex:0 source:_imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil]; if (image) { image.sd_imageFormat = self.class.imageFormat; } @@ -657,14 +650,7 @@ static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestination (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES), (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage }; - CGImageSourceRef imageSource = _imageSource; - if (imageSource != NULL) { - CFRetain(imageSource); - } else { - return nil; - } - UIImage *image = [self.class createFrameAtIndex:index source:imageSource scale:_scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:options]; - CFRelease(imageSource); + UIImage *image = [self.class createFrameAtIndex:index source:_imageSource scale:_scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:options]; if (!image) { return nil; }