Commit 2ad906a8 authored by Vasilii Sukhanov's avatar Vasilii Sukhanov Committed by Commit Bot

Fix a crash in the leak detection dialog on dismissing it.

CredentialLeakDialogView::Accept nulls the controller and creates a new tab.
During tab creation the framework may call some methods on the view to get its
title or buttons. Previosuly that led to a crash.
It doesn't matter what to return in those methods because the dialog is being
destroyed anyway.

Bug: 1039452,1036422
Change-Id: I985b7e79ac78431e216d3f27de001683846a29b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1991563Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729395}
parent d7e058f6
......@@ -138,7 +138,9 @@ bool CredentialLeakDialogView::Close() {
}
int CredentialLeakDialogView::GetDialogButtons() const {
return controller_->ShouldShowCancelButton()
// |controller_| can be nullptr when the framework calls this method after a
// button click.
return controller_ && controller_->ShouldShowCancelButton()
? ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL
: ui::DIALOG_BUTTON_OK;
}
......@@ -153,7 +155,9 @@ void CredentialLeakDialogView::OnThemeChanged() {
}
base::string16 CredentialLeakDialogView::GetWindowTitle() const {
return controller_->GetTitle();
// |controller_| can be nullptr when the framework calls this method after a
// button click.
return controller_ ? controller_->GetTitle() : base::string16();
}
void CredentialLeakDialogView::InitWindow() {
......
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