Fix the test case again on below iOS 15

This commit is contained in:
DreamPiggy 2022-11-08 21:18:20 +08:00
parent f8d353b50c
commit 7ddf3214e6
1 changed files with 8 additions and 6 deletions

View File

@ -23,8 +23,8 @@ static NSString * kSDCGImageSourceRasterizationDPI = @"kCGImageSourceRasterizati
// Specify File Size for lossy format encoding, like JPEG
static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestinationRequestedFileSize";
// Only assert on Debug mode and Simulator
#define SD_CHECK_CGIMAGE_RETAIN_SOURCE DEBUG && TARGET_OS_SIMULATOR && \
// Only assert on Debug mode
#define SD_CHECK_CGIMAGE_RETAIN_SOURCE DEBUG && \
((__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0)) || \
((__TV_OS_VERSION_MAX_ALLOWED >= __TVOS_15_0))
@ -300,10 +300,12 @@ static CGImageRef __nullable SDCGImageCreateCopy(CGImageRef cg_nullable image) {
}
}
#if SD_CHECK_CGIMAGE_RETAIN_SOURCE
// Assert here to check CGImageRef should not retain the CGImageSourceRef and has possible thread-safe issue (this is behavior on iOS 15+)
// If assert hit, fire issue to https://github.com/SDWebImage/SDWebImage/issues and we update the condition for this behavior check
extern CGImageSourceRef CGImageGetImageSource(CGImageRef);
NSCAssert(!CGImageGetImageSource(imageRef), @"Animated Coder created CGImageRef should not retain CGImageSourceRef, which may cause thread-safe issue without lock");
if (@available(iOS 15, tvOS 15, *)) {
// Assert here to check CGImageRef should not retain the CGImageSourceRef and has possible thread-safe issue (this is behavior on iOS 15+)
// If assert hit, fire issue to https://github.com/SDWebImage/SDWebImage/issues and we update the condition for this behavior check
extern CGImageSourceRef CGImageGetImageSource(CGImageRef);
NSCAssert(!CGImageGetImageSource(imageRef), @"Animated Coder created CGImageRef should not retain CGImageSourceRef, which may cause thread-safe issue without lock");
}
#endif
#if SD_UIKIT || SD_WATCH