Skip to content

Commit

Permalink
exo: Fix multi-display cursor crash
Browse files Browse the repository at this point in the history
The cursor surface is parented to the primary root window, which may
change when using multiple displays. This CL fixes a crash caused by
removing the child from the primary root window when the parent is a
different root window or the child is orphaned.

BUG=714832
TEST=No crashes after changing primary display.

Review-Url: https://codereview.chromium.org/2862953002
Cr-Commit-Position: refs/heads/master@{#469543}
  • Loading branch information
domlaskowski authored and Commit bot committed May 5, 2017
1 parent 2148f56 commit 8d03afa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/exo/pointer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ void Pointer::SetCursor(Surface* surface, const gfx::Point& hotspot) {
}
if (surface_) {
surface_->window()->SetTransform(gfx::Transform());
WMHelper::GetInstance()
->GetContainer(ash::kShellWindowId_MouseCursorContainer)
->RemoveChild(surface_->window());
if (surface_->window()->parent())
surface_->window()->parent()->RemoveChild(surface_->window());
surface_->SetSurfaceDelegate(nullptr);
surface_->RemoveSurfaceObserver(this);
}
Expand Down

0 comments on commit 8d03afa

Please sign in to comment.