Commit a9960587 authored by pkotwicz's avatar pkotwicz Committed by Commit bot

[Athena] Fix potential crash when overview window is deleted

Delete the window immediately in WindowOverviewModeImpl::CloseDragWindow() and
use wm::ScopedHidingAnimationSettings to make then hide animation look right.
This fixes a potential crash if overview mode is exited while a window is
animating closed.

BUG=409724
TEST=None

Review URL: https://codereview.chromium.org/555463003

Cr-Commit-Position: refs/heads/master@{#294050}
parent ec9ac20a
......@@ -28,6 +28,7 @@
#include "ui/gfx/frame_time.h"
#include "ui/gfx/transform.h"
#include "ui/wm/core/shadow_types.h"
#include "ui/wm/core/window_animations.h"
#include "ui/wm/core/window_util.h"
namespace {
......@@ -480,12 +481,9 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
void CloseDragWindow(const ui::GestureEvent& gesture) {
// Animate |dragged_window_| offscreen first, then destroy it.
{
ui::ScopedLayerAnimationSettings settings(
dragged_window_->layer()->GetAnimator());
settings.SetPreemptionStrategy(
wm::ScopedHidingAnimationSettings settings(dragged_window_);
settings.layer_animation_settings()->SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
settings.AddObserver(new ui::ClosureAnimationObserver(
base::Bind(&base::DeletePointer<aura::Window>, dragged_window_)));
WindowOverviewState* dragged_state =
dragged_window_->GetProperty(kWindowOverviewState);
......@@ -547,6 +545,7 @@ class WindowOverviewModeImpl : public WindowOverviewMode,
}
}
delete dragged_window_;
dragged_window_ = NULL;
}
......
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