Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #7831: Fixed PopoverController not deallocating (#7833)
Browse files Browse the repository at this point in the history
Fixed PopoverController not deallocating due to cyclical references capturing its model and model capturing popover.
  • Loading branch information
Brandon-T authored and iccub committed Aug 4, 2023
1 parent 54ae744 commit 1ac5acb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ extension BrowserViewController {
didDismiss()
}

borderView.didClickBorderedArea = {
borderView.didClickBorderedArea = { [weak popover] in
maskShape.removeFromSuperlayer()
borderView.removeFromSuperview()

popover.dismissPopover() {
popover?.dismissPopover() {
didClickBorderedArea()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ extension BrowserViewController: PlaylistScriptHandlerDelegate, PlaylistFolderSh
DispatchQueue.main.async {
let model = OnboardingPlaylistModel()
let popover = PopoverController(content: OnboardingPlaylistView(model: model))
popover.previewForOrigin = .init(view: self.topToolbar.locationView.playlistButton, action: { popover in
popover.previewForOrigin = .init(view: self.topToolbar.locationView.playlistButton, action: { [weak tab] popover in
guard let item = tab?.playlistItem else {
popover.dismissPopover()
return
Expand All @@ -233,8 +233,8 @@ extension BrowserViewController: PlaylistScriptHandlerDelegate, PlaylistFolderSh
})
popover.present(from: self.topToolbar.locationView.playlistButton, on: self)

model.onboardingCompleted = {
popover.dismissPopover()
model.onboardingCompleted = { [weak tab, weak popover] in
popover?.dismissPopover()
self.openPlaylist(tab: tab, item: tab?.playlistItem)
}
}
Expand Down

0 comments on commit 1ac5acb

Please sign in to comment.