diff options
| -rw-r--r-- | ios/MullvadVPN/Classes/CustomAlertViewController.swift | 8 | ||||
| -rw-r--r-- | ios/MullvadVPN/Operations/PresentAlertOperation.swift | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/ios/MullvadVPN/Classes/CustomAlertViewController.swift b/ios/MullvadVPN/Classes/CustomAlertViewController.swift index 42ceaf3c4b..5a99673a0d 100644 --- a/ios/MullvadVPN/Classes/CustomAlertViewController.swift +++ b/ios/MullvadVPN/Classes/CustomAlertViewController.swift @@ -94,11 +94,6 @@ class CustomAlertViewController: UIViewController { } } - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) - handlers.removeAll() - } - func addAction(title: String, style: ActionStyle, handler: (() -> Void)? = nil) { // The presence of a button should reset any custom button margin to default. containerView.directionalLayoutMargins.bottom = UIMetrics.CustomAlert.containerMargins.bottom @@ -183,8 +178,9 @@ class CustomAlertViewController: UIViewController { if let handler = handlers[button] { handler() } - didDismiss?() + didDismiss = nil + handlers.removeAll() } } } diff --git a/ios/MullvadVPN/Operations/PresentAlertOperation.swift b/ios/MullvadVPN/Operations/PresentAlertOperation.swift index dda17b15af..7dff3399f6 100644 --- a/ios/MullvadVPN/Operations/PresentAlertOperation.swift +++ b/ios/MullvadVPN/Operations/PresentAlertOperation.swift @@ -37,8 +37,8 @@ final class PresentAlertOperation: AsyncOperation { } override func main() { - alertController.didDismiss = { - self.finish() + alertController.didDismiss = { [weak self] in + self?.finish() } presentingController.present(alertController, animated: true) { |
