Don't use prepareThumbnail in Compose screen

Fixes crash when sharing certain images to share sheet extension
This commit is contained in:
Shadowfacts 2023-05-13 12:38:51 -04:00
parent a9a9bfebeb
commit ae8191ca0e
1 changed files with 11 additions and 9 deletions

View File

@ -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
}
}
} else {
image.prepareThumbnail(of: CGSize(width: 80, height: 80)) { 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
// }
// }
// }
}
}
}