Commit 00d1fa84 authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Commit Bot

Fix a crash when tablet mode ends before dropping a window

When a window is dragged to overview by gesture dragging from
shelf, tablet mode can end before the drag ends, at which point
The homescreen window is closed, and we can't use it to get the
SplitViewController.

This CL reworks ShouldShowHomeScreen() to fix the crash, and do only
the next checks if the previous ones failed.

BUG=1101143
TEST=Manually by exiting tablet mode while dragging a window from shelf.

Change-Id: I6a58e1c7caa6ebccc45d47cbfa27136891cfee9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285609Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786082}
parent 3c16723c
......@@ -433,15 +433,20 @@ void HomeScreenController::UpdateVisibility() {
}
bool HomeScreenController::ShouldShowHomeScreen() const {
const bool in_tablet_mode =
Shell::Get()->tablet_mode_controller()->InTabletMode();
const bool in_overview =
Shell::Get()->overview_controller()->InOverviewSession();
const bool in_split_view =
SplitViewController::Get(delegate_->GetHomeScreenWindow())
->InSplitViewMode();
return in_tablet_mode && !in_overview && !in_wallpaper_preview_ &&
!in_window_dragging_ && !in_split_view;
if (in_window_dragging_ || in_wallpaper_preview_)
return false;
auto* window = delegate_->GetHomeScreenWindow();
if (!window)
return false;
auto* shell = Shell::Get();
if (!shell->tablet_mode_controller()->InTabletMode())
return false;
if (shell->overview_controller()->InOverviewSession())
return false;
return !SplitViewController::Get(window)->InSplitViewMode();
}
} // namespace ash
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