Skip to content

Commit

Permalink
make delegate weak to avoid potential retain cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
Momo Ozawa committed Oct 23, 2023
1 parent 11ab0be commit 67b8085
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion WordPress/Classes/ViewRelated/Post/PostMenuHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ struct PostMenuHelper {
let post = statusViewModel.post

return buttons.map { button in
UIAction(title: button.title(for: post), image: button.icon, attributes: button.attributes, handler: { _ in
UIAction(title: button.title(for: post), image: button.icon, attributes: button.attributes, handler: { [weak delegate] _ in
guard let delegate else { return }
button.performAction(for: post, view: presentingView, delegate: delegate)
})
}
Expand Down

0 comments on commit 67b8085

Please sign in to comment.