Add CHECKs to help investigate

From the crash stack, |Widget::widget_delegate_| has been deleted but
not set to nullptr, thus caused the nullptr dereference crash. However,
we did not find the equivalent number of crashes in

This CL does:

1) Change DCHECK to CHECK in Widget::~Widget() when NATIVE_WIDGET_OWNS_WIDGET
to see if we can get another crash stack to help investigate the bug.
If crashes happen here, means Widget is destroyed while its native widget is
still alive, thus Widget::OnNativeWidgetDestroyed() is not called, thus
|widget_delegate_| is not set to nullptr.

2) Besides that, it may be also possible that a window is destroyed while
building up the mru window. We added a scoped window observer to observe
window in IsWindowConsideredActivatable() and see if there is any window is
destroyed out from the function.

Bug: 937381
Change-Id: I01172cc36fcb19078a5d416d7c87fb505f6304d7
Commit-Queue: Xiaoqian Dai <>
Reviewed-by: Scott Violet <>
Cr-Commit-Position: refs/heads/master@{#661386}
2 files changed