From ae8191ca0e4f438b8dd20f33b9c0cca72d11d2bc Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 13 May 2023 12:38:51 -0400 Subject: [PATCH] Don't use prepareThumbnail in Compose screen Fixes crash when sharing certain images to share sheet extension --- .../AttachmentThumbnailController.swift | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentThumbnailController.swift b/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentThumbnailController.swift index c405fb2f..4c465b3a 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentThumbnailController.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Controllers/AttachmentThumbnailController.swift @@ -95,19 +95,21 @@ class AttachmentThumbnailController: ViewController { self.gifController = GIFController(gifData: data) } else if type.conforms(to: .image), let image = UIImage(data: data) { - if fullSize { + // using prepareThumbnail on images from PHPicker results in extremely high memory usage, + // crashing share extension. see FB12186346 +// if fullSize { image.prepareForDisplay { prepared in DispatchQueue.main.async { - self.image = prepared + self.image = image } } - } else { - image.prepareThumbnail(of: CGSize(width: 80, height: 80)) { prepared in - DispatchQueue.main.async { - self.image = prepared - } - } - } +// } else { +// image.prepareThumbnail(of: CGSize(width: 80, height: 80)) { prepared in +// DispatchQueue.main.async { +// self.image = prepared +// } +// } +// } } } }