Commit d65792a6 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Check non_client_view_ in Widget::OnSizeConstraintsChanged

This can be nullptr and this is always checked against nullptr
except this place.

BUG=NONE
TEST=covered by unit test

Change-Id: Ie96065820a16dd14552a03d62ae7b06b4e2facb6
Reviewed-on: https://chromium-review.googlesource.com/1105698Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568515}
parent 306b51eb
...@@ -830,6 +830,7 @@ void Widget::UpdateWindowTitle() { ...@@ -830,6 +830,7 @@ void Widget::UpdateWindowTitle() {
base::i18n::AdjustStringForLocaleDirection(&window_title); base::i18n::AdjustStringForLocaleDirection(&window_title);
if (!native_widget_->SetWindowTitle(window_title)) if (!native_widget_->SetWindowTitle(window_title))
return; return;
non_client_view_->UpdateWindowTitle(); non_client_view_->UpdateWindowTitle();
// If the non-client view is rendering its own title, it'll need to relayout // If the non-client view is rendering its own title, it'll need to relayout
...@@ -995,7 +996,8 @@ bool Widget::IsTranslucentWindowOpacitySupported() const { ...@@ -995,7 +996,8 @@ bool Widget::IsTranslucentWindowOpacitySupported() const {
void Widget::OnSizeConstraintsChanged() { void Widget::OnSizeConstraintsChanged() {
native_widget_->OnSizeConstraintsChanged(); native_widget_->OnSizeConstraintsChanged();
non_client_view_->SizeConstraintsChanged(); if (non_client_view_)
non_client_view_->SizeConstraintsChanged();
} }
void Widget::OnOwnerClosing() {} void Widget::OnOwnerClosing() {}
......
...@@ -2235,6 +2235,14 @@ TEST_F(WidgetTest, NoCrashOnWidgetDelete) { ...@@ -2235,6 +2235,14 @@ TEST_F(WidgetTest, NoCrashOnWidgetDelete) {
widget->Init(params); widget->Init(params);
} }
TEST_F(WidgetTest, NoCrashOnResizeConstraintsWindowTitleOnPopup) {
std::unique_ptr<Widget> widget(new Widget);
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP);
params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget->Init(params);
widget->OnSizeConstraintsChanged();
}
// Tests that we do not crash when a Widget is destroyed before it finishes // Tests that we do not crash when a Widget is destroyed before it finishes
// processing of pending input events in the message loop. // processing of pending input events in the message loop.
TEST_F(WidgetTest, NoCrashOnWidgetDeleteWithPendingEvents) { TEST_F(WidgetTest, NoCrashOnWidgetDeleteWithPendingEvents) {
......
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