diff --git a/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentsListController.swift b/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentsListController.swift index 611a2dd304..56bae119e9 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentsListController.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentsListController.swift @@ -85,8 +85,11 @@ class AttachmentsListController: ViewController { for provider in itemProviders where provider.canLoadObject(ofClass: DraftAttachment.self) { provider.loadObject(ofClass: DraftAttachment.self) { object, error in guard let attachment = object as? DraftAttachment else { return } - DispatchQueue.main.async { - guard self.canAddAttachment else { return } + DispatchQueue.main.async { [weak self] in + guard let self, + self.canAddAttachment else { + return + } DraftsPersistentContainer.shared.viewContext.insert(attachment) attachment.draft = self.draft self.draft.attachments.add(attachment)