Commit b4e50245 authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Hopefully detect/prevent crash in PageInfoBubbleView::OnWidgetDestroying()

Make sure that the callback is not null, and that we use the widget that
is reported being closed rather than calling GetWidget() - just in case
the view has somehow come unglued from the widget.

I really can't think of any other way this could crash.

Bug: 966308
Change-Id: Ic0c2ee9adb8b1e26326c1300238db058e5022819
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627817
Commit-Queue: Dana Fried <dfried@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Auto-Submit: Dana Fried <dfried@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662826}
parent 965143d8
......@@ -470,6 +470,8 @@ PageInfoBubbleView::PageInfoBubbleView(
web_contents),
profile_(profile),
closing_callback_(std::move(closing_callback)) {
DCHECK(closing_callback_);
// Capture the default bubble margin, and move it to the Layout classes. This
// is necessary so that the views::Separator can extend the full width of the
// bubble.
......@@ -558,7 +560,7 @@ void PageInfoBubbleView::OnWidgetDestroying(views::Widget* widget) {
PageInfoBubbleViewBase::OnWidgetDestroying(widget);
bool reload_prompt;
presenter_->OnUIClosing(&reload_prompt);
std::move(closing_callback_).Run(GetWidget()->closed_reason(), reload_prompt);
std::move(closing_callback_).Run(widget->closed_reason(), reload_prompt);
}
void PageInfoBubbleView::ButtonPressed(views::Button* button,
......
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