Commit 46feb737 authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Speculative fix for shutdown crash in SetShelfBehaviorsFromPrefs

ShelfController outlives TabletModeController. However, it looks like
Shell destruction can trigger display layout changes, which are
observed by ShelfController. These may be dependent on screen rotation
animation state, and hence are hard to repro.

Add a null check to avoid the crash, since this is simple and safe to
backport. A followup CL will clean up the shutdown ordering.

Bug: 817522
Change-Id: I7d02faf6179768457e56dff8bfdf2a74c8701b4c
Reviewed-on: https://chromium-review.googlesource.com/966785Reviewed-by: default avatarWeidong Guo <weidongg@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543748}
parent 50cd8a6d
......@@ -86,9 +86,11 @@ void SetShelfAlignmentFromPrefs() {
void SetShelfBehaviorsFromPrefs() {
// The shelf should always be bottom-aligned and not hidden in tablet mode;
// alignment and auto-hide are assigned from prefs when tablet mode is exited.
if (Shell::Get()
->tablet_mode_controller()
->IsTabletModeWindowManagerEnabled()) {
// ShelfController outlives TabletModeController, hence the null check.
// https://crbug.com/817522
Shell* shell = Shell::Get();
if (shell->tablet_mode_controller() &&
shell->tablet_mode_controller()->IsTabletModeWindowManagerEnabled()) {
return;
}
......
......@@ -818,6 +818,7 @@ Shell::~Shell() {
shelf_window_watcher_.reset();
// Removes itself as an observer of |pref_service_|.
// TODO(jamescook): Uses tablet_mode_controller_. Add separate shutdown pass.
shelf_controller_.reset();
// NightLightController depends on the PrefService as well as the window tree
......
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