Commit 360d2e94 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Speculative fix for DownloadManagerViewController callback crash.

This crash does not have steps to reproduce and can occur if Download
Task in coordinator is null or invalid. This change gracefully handles
the case when task became null after coordinator was stopped.

Setting view controller delegate to nil will prevent callbacks
from view controller which is being dismissed.

Bug: 824758
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I44099adf5604dba25e937670312f7fff5af2f56d
Reviewed-on: https://chromium-review.googlesource.com/975666Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545161}
parent 99341850
...@@ -120,6 +120,8 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver { ...@@ -120,6 +120,8 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver {
- (void)stop { - (void)stop {
if (_viewController) { if (_viewController) {
[self.presenter dismissAnimated:YES]; [self.presenter dismissAnimated:YES];
// Prevent delegate callbacks for stopped coordinator.
_viewController.delegate = nil;
_viewController = nil; _viewController = nil;
} }
[_confirmationDialog dismissViewControllerAnimated:YES completion:nil]; [_confirmationDialog dismissViewControllerAnimated:YES completion:nil];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment