Commit ace43e3a authored by Andrew Xu's avatar Andrew Xu Committed by Commit Bot

Check tablet mode controller pointer

It is an issue reported by Fuzz. However, I cannot reproduce the issue
through Fuzz on my work station although following the reproduction
instructions (attached to the issue page) very carefully. Based on the
call stack, the story should be:
When destructing ash::Shell, all windows are destructed as well via
Shell::CloseAllRootWindowChildWindows(). However, TabletModeController
is destructed before window's destruction. Meanwhile, during window's
destruction (like Hotseat), it may utilize TabletModeController.

This CL serves as a quick fixing for M-83. Another issue (1067490) is
created for the real fixing.

Bug: 1066265
Change-Id: I43a2f809facaad2254bd288716ca4742e76d471e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132841
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756153}
parent e4e92305
...@@ -2105,9 +2105,17 @@ gfx::Insets ScrollableShelfView::CalculateRipplePaddingInsets() const { ...@@ -2105,9 +2105,17 @@ gfx::Insets ScrollableShelfView::CalculateRipplePaddingInsets() const {
gfx::RoundedCornersF gfx::RoundedCornersF
ScrollableShelfView::CalculateShelfContainerRoundedCorners() const { ScrollableShelfView::CalculateShelfContainerRoundedCorners() const {
if (!chromeos::switches::ShouldShowShelfHotseat() || // This function may access TabletModeController during destruction of
!Shell::Get()->IsInTabletMode()) // Hotseat. However, TabletModeController is destructed before Hotseat. So
// check the pointer explicitly here.
// TODO(andrewxu): reorder the destruction order in Shell::~Shell then remove
// the explicit check.
const bool is_in_tablet_mode =
Shell::Get()->tablet_mode_controller() && Shell::Get()->IsInTabletMode();
if (!chromeos::switches::ShouldShowShelfHotseat() || !is_in_tablet_mode) {
return gfx::RoundedCornersF(); return gfx::RoundedCornersF();
}
const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment();
const float radius = (is_horizontal_alignment ? height() : width()) / 2.f; const float radius = (is_horizontal_alignment ? height() : width()) / 2.f;
......
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