Skip to content

Commit 2fd0f1c

Browse files
authored
Break a retain cycle between a UIAction and UIViewController (#24993)
1 parent 7388010 commit 2fd0f1c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaAddMediaMenuController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ final class SiteMediaAddMediaMenuController: NSObject, PHPickerViewControllerDel
3737
}
3838
if blog.isHostedAtWPcom, blog.isQuotaAvailable {
3939
children += [
40-
UIAction(title: Strings.viewUsage, subtitle: blog.quotaUsageShortDescription, image: UIImage(systemName: "opticaldiscdrive"), handler: { _ in
40+
UIAction(
41+
title: Strings.viewUsage,
42+
subtitle: blog.quotaUsageShortDescription,
43+
image: UIImage(systemName: "opticaldiscdrive")
44+
) { [weak self, weak viewController] _ in
45+
guard let self, let viewController else { return }
4146
self.showQuotaView(from: viewController)
42-
})
47+
}
4348
]
4449
}
4550
return UIMenu(options: [.displayInline], children: children)

0 commit comments

Comments
 (0)