Fix a race condition when sending multiple images.

This commit is contained in:
Doug
2022-08-04 17:21:06 +01:00
committed by Doug
parent ffcc512f02
commit 63da4b7bdf
2 changed files with 7 additions and 4 deletions

View File

@@ -96,11 +96,13 @@ public class ShareExtensionShareItemProvider: NSObject {
shareExtensionItem.loaded = false
shareExtensionItem.itemProvider.loadItem(forTypeIdentifier: typeIdentifier, options: nil) { result, error in
if error == nil {
shareExtensionItem.loaded = true
}
DispatchQueue.main.async {
// Mark the item as loaded when back on the main queue to avoid
// a race condition where the share extension sends duplicates.
if error == nil {
shareExtensionItem.loaded = true
}
completion(result, error)
}
}

1
changelog.d/5922.bugfix Normal file
View File

@@ -0,0 +1 @@
Share Extension: Fix a bug where sending multiple images sometimes resulted in additional duplicates being sent.