From 0d44d70e6209aabd357d510e49b91ad0349ba1c6 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 26 Dec 2019 17:44:09 +0800 Subject: [PATCH 1/4] Fix the issue that "There may be no complete callback when download the picture of the local path" --- SDWebImage/Core/SDWebImageDownloader.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SDWebImage/Core/SDWebImageDownloader.m b/SDWebImage/Core/SDWebImageDownloader.m index 5b931ea2..94bfa049 100644 --- a/SDWebImage/Core/SDWebImageDownloader.m +++ b/SDWebImage/Core/SDWebImageDownloader.m @@ -226,10 +226,11 @@ static void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext; SD_UNLOCK(self.operationsLock); }; self.URLOperations[url] = operation; + // Add the handlers before submitting to operation queue, avoid the race condition that operation finished before setting handlers. + downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock]; // Add operation to operation queue only after all configuration done according to Apple's doc. // `addOperation:` does not synchronously execute the `operation.completionBlock` so this will not cause deadlock. [self.downloadQueue addOperation:operation]; - downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock]; } else { // When we reuse the download operation to attach more callbacks, there may be thread safe issue because the getter of callbacks may in another queue (decoding queue or delegate queue) // So we lock the operation here, and in `SDWebImageDownloaderOperation`, we use `@synchonzied (self)`, to ensure the thread safe between these two classes. From d44a5a331e65489e6306eb45f98c542138b1657f Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 13 Dec 2019 17:26:20 +0800 Subject: [PATCH 2/4] update the Readme with PDF/SVG/Link plugin repos from SDWebImage organization --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6199e699..f18658fb 100644 --- a/README.md +++ b/README.md @@ -56,10 +56,13 @@ We support SwiftUI by building with the functions (caching, loading and animatio - [SDWebImageBPGCoder](https://github.com/SDWebImage/SDWebImageBPGCoder) - coder for BPG format - [SDWebImageFLIFCoder](https://github.com/SDWebImage/SDWebImageFLIFCoder) - coder for FLIF format - [SDWebImageAVIFCoder](https://github.com/SDWebImage/SDWebImageAVIFCoder) - coder for AVIF (AV1-based) format +- [SDWebImagePDFCoder](https://github.com/SDWebImage/SDWebImagePDFCoder) - coder for PDF vector format image +- [SDWebImageSVGCoder](https://github.com/SDWebImage/SDWebImageSVGCoder) - coder for SVG vector format image - and more from community! #### Loaders - [SDWebImagePhotosPlugin](https://github.com/SDWebImage/SDWebImagePhotosPlugin) - plugin to support loading images from Photos (using `Photos.framework`) +- [SDWebImageLinkPlugin](https://github.com/SDWebImage/SDWebImageLinkPlugin) - plugin to support loading images from rich link url, as well as `LPLinkView` (using `LinkPresentation.framework`) #### Integration with 3rd party libraries - [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin) - plugin to support [FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) as the engine for animated GIFs From 0b3079d66b6f486376c9ce40f7f146b930d979df Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 16 Dec 2019 12:44:52 +0800 Subject: [PATCH 3/4] Fix the test case compile warning of `SDWebImageTestDiskCache` --- Tests/Tests/SDWebImageTestCache.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tests/Tests/SDWebImageTestCache.m b/Tests/Tests/SDWebImageTestCache.m index 7ef29cf7..68b2a154 100644 --- a/Tests/Tests/SDWebImageTestCache.m +++ b/Tests/Tests/SDWebImageTestCache.m @@ -9,6 +9,9 @@ #import "SDWebImageTestCache.h" #import +#import "SDFileAttributeHelper.h" + +static NSString * const SDWebImageTestDiskCacheExtendedAttributeName = @"com.hackemist.SDWebImageTestDiskCache"; @implementation SDWebImageTestMemoryCache @@ -104,4 +107,18 @@ return size; } +- (nullable NSData *)extendedDataForKey:(nonnull NSString *)key { + NSString *cachePathForKey = [self cachePathForKey:key]; + return [SDFileAttributeHelper extendedAttribute:SDWebImageTestDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil]; +} + +- (void)setExtendedData:(nullable NSData *)extendedData forKey:(nonnull NSString *)key { + NSString *cachePathForKey = [self cachePathForKey:key]; + if (!extendedData) { + [SDFileAttributeHelper removeExtendedAttribute:SDWebImageTestDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil]; + } else { + [SDFileAttributeHelper setExtendedAttribute:SDWebImageTestDiskCacheExtendedAttributeName value:extendedData atPath:cachePathForKey traverseLink:NO overwrite:YES error:nil]; + } +} + @end From 247f74a5d191e9c6bd601d292c99cf9fe1658930 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 27 Dec 2019 15:05:43 +0800 Subject: [PATCH 4/4] Bumped version to 5.4.1 Update the CHANGELOG --- CHANGELOG.md | 6 ++++++ SDWebImage.podspec | 2 +- WebImage/Info.plist | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed842941..04c166c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [5.4.1 - 5.4 Patch, on Dec 27th, 2019](https://github.com/rs/SDWebImage/releases/tag/5.4.1) +See [all tickets marked for the 5.4.1 release](https://github.com/SDWebImage/SDWebImage/milestone/56) + +### Fixes +- Fix the issue that "There may be no complete callback when download the picture of the local path" #2917 + ## [5.4.0 Extended Cache Metadata, on Dec 6th, 2019](https://github.com/rs/SDWebImage/releases/tag/5.4.0) See [all tickets marked for the 5.4.0 release](https://github.com/SDWebImage/SDWebImage/milestone/51) diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 6e7c4229..1db2f2cf 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SDWebImage' - s.version = '5.4.0' + s.version = '5.4.1' s.osx.deployment_target = '10.10' s.ios.deployment_target = '8.0' diff --git a/WebImage/Info.plist b/WebImage/Info.plist index 7c51b93f..beb1d1ec 100644 --- a/WebImage/Info.plist +++ b/WebImage/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 5.4.0 + 5.4.1 CFBundleSignature ???? CFBundleVersion - 5.4.0 + 5.4.1 NSPrincipalClass