LayerAnimator should withdraw from processing animation queue when its delegate becomes nullptr.
BUG=
Review URL: https://codereview.chromium.org/795113002
Cr-Commit-Position: refs/heads/master@{#310354}
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index 39585a7..adff73f 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -409,7 +409,7 @@
void LayerAnimator::StopAnimatingInternal(bool abort) {
scoped_refptr<LayerAnimator> retain(this);
- while (is_animating()) {
+ while (is_animating() && delegate()) {
// We're going to attempt to finish the first running animation. Let's
// ensure that it's valid.
PurgeDeletedAnimations();
@@ -517,6 +517,8 @@
sequence->Abort(delegate());
else
ProgressAnimationToEnd(sequence);
+ if (!delegate())
+ return;
ProcessQueue();
UpdateAnimationState();
}