mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 00:01:00 +00:00
Ensure no memory leaks caused by image download completion blocks
This commit is contained in:
parent
47a43e6cb4
commit
36b618c03d
2 changed files with 6 additions and 6 deletions
|
@ -190,13 +190,13 @@ private extension EditAttachmentViewController {
|
|||
SDWebImageManager.shared.loadImage(
|
||||
with: viewModel.attachment.url.url,
|
||||
options: [],
|
||||
progress: nil) { image, _, _, _, _, _ in
|
||||
guard let cgImage = image?.cgImage else { return }
|
||||
progress: nil) { [weak self] image, _, _, _, _, _ in
|
||||
guard let self = self, let cgImage = image?.cgImage else { return }
|
||||
|
||||
self.detectText(cgImage: cgImage)
|
||||
.sink { [weak self] in
|
||||
.sink {
|
||||
if case let .failure(error) = $0 {
|
||||
self?.present(alertItem: .init(error: error))
|
||||
self.present(alertItem: .init(error: error))
|
||||
}
|
||||
} receiveValue: { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
|
|
@ -140,11 +140,11 @@ final class ImageViewController: UIViewController {
|
|||
}
|
||||
|
||||
imageView.sd_setImage(with: viewModel.attachment.url.url,
|
||||
placeholderImage: placeholderImage) { _, error, _, _ in
|
||||
placeholderImage: placeholderImage) { [weak self] _, error, _, _ in
|
||||
if error != nil {
|
||||
let alertItem = AlertItem(error: ImageError.unableToLoad)
|
||||
|
||||
self.present(alertItem: alertItem)
|
||||
self?.present(alertItem: alertItem)
|
||||
}
|
||||
}
|
||||
case .gifv:
|
||||
|
|
Loading…
Reference in a new issue