Commit 17c90686 authored by David Black's avatar David Black Committed by Commit Bot

Fix crash in Assistant's AnimatedContainerView.

Crash was caused by overlapping animate-out animations.

Bug: b:157521638, b:151979172, b:145136105
Change-Id: I71787905346a29a3d238d172a5660e252d3c4f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216617
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarJeroen Dhollander <jeroendh@google.com>
Cr-Commit-Position: refs/heads/master@{#772418}
parent 062e4d3a
......@@ -177,10 +177,10 @@ void AnimatedContainerView::ChangeResponse(
// view hierarchy can be removed before the underlying views are destroyed.
queued_response_ = response;
// If we are currently fading out the old content, don't interrupt it.
// When the fading out is completed, it will detect we've got a queued
// response and animate it in.
if (fade_out_in_progress_)
// If we are currently animating-/fading-out the old content, don't interrupt
// it. When the animating-/fading-out is completed, it will detect we've got a
// queued response and animate it in.
if (animate_out_in_progress_ || fade_out_in_progress_)
return;
// If we don't have any pre-existing content, there is nothing to animate off
......@@ -190,6 +190,8 @@ void AnimatedContainerView::ChangeResponse(
return;
}
animate_out_in_progress_ = true;
// There is a previous response on stage, so we'll animate it off before
// adding the new response. The new response will be added upon invocation
// of the exit animation ended callback.
......@@ -332,6 +334,8 @@ bool AnimatedContainerView::AnimateOutObserverCallback(
if (!weak_ptr)
return true;
weak_ptr->animate_out_in_progress_ = false;
// If the exit animation was aborted, we just return true to delete our
// observer. No further action is needed.
if (observer.aborted_count())
......
......@@ -151,6 +151,9 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AnimatedContainerView
// reduces layout passes.
bool propagate_preferred_size_changed_ = true;
// Whether the animate-out animation is in progress.
bool animate_out_in_progress_ = false;
// Whether the fade-out animation is in progress.
bool fade_out_in_progress_ = false;
......
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