Skip to content

Commit 2a82844

Browse files
authored
Fix (potential) for popover crash (#24884)
1 parent 3578326 commit 2a82844

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

WordPress/Classes/ViewRelated/Tips/AppTips.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ extension UIViewController {
107107
_ tip: some Tip,
108108
sourceItem: any UIPopoverPresentationControllerSourceItem,
109109
arrowDirection: UIPopoverArrowDirection? = nil,
110-
actionHandler: ((Tips.Action) -> Void)? = nil
110+
actionHandler: (@MainActor @Sendable (Tips.Action) -> Void)? = nil
111111
) -> TipObserver? {
112-
let task = Task { @MainActor [weak self] in
112+
let task = Task { @MainActor [weak self, weak sourceItem] in
113113
for await shouldDisplay in tip.shouldDisplayUpdates {
114-
if shouldDisplay {
114+
if shouldDisplay, let sourceItem {
115115
let popoverController = TipUIPopoverViewController(tip, sourceItem: sourceItem, actionHandler: actionHandler ?? { _ in })
116116
popoverController.view.tintColor = .secondaryLabel
117117
if let arrowDirection {

0 commit comments

Comments
 (0)