Index: ui/message_center/views/toast_contents_view.cc |
diff --git a/ui/message_center/views/toast_contents_view.cc b/ui/message_center/views/toast_contents_view.cc |
index d5fdbb952dfbda06253e21a74079e1a6d996e426..bd2fd6d89049641683623e884f7c427f39d87569 100644 |
--- a/ui/message_center/views/toast_contents_view.cc |
+++ b/ui/message_center/views/toast_contents_view.cc |
@@ -214,11 +214,15 @@ void ToastContentsView::StartFadeIn() { |
void ToastContentsView::OnBoundsAnimationEndedOrCancelled( |
const ui::Animation* animation) { |
- if (collection_) |
- collection_->DecrementDeferCounter(); |
- |
if (is_closing_ && closing_animation_ == animation && GetWidget()) |
GetWidget()->Close(); |
+ |
+ // This cannot be called before GetWidget()->Close(). Decrementing defer count |
+ // will invoke update, which may invoke another close animation with |
+ // incrementing defer counter. Close() after such process will cause a |
+ // mismatch between increment/decrement. See crbug.com/238477 |
+ if (collection_) |
+ collection_->DecrementDeferCounter(); |
} |
// ui::AnimationDelegate |