Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: ui/keyboard/keyboard_controller.cc

Issue 1094863005: Fix a crash in dtor of CallbackAnimationObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_controller.cc
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 5aa44bbbaf599bf7c431ec55456e8e7277092d80..f410b4c97373de94e8d3be972ae5733c95e76018 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -124,6 +124,7 @@ class CallbackAnimationObserver : public ui::LayerAnimationObserver {
void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override;
void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override;
void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {}
+ bool RequiresNotificationWhenAnimatorDestroyed() const override;
ui::LayerAnimator* animator_;
sadrul 2015/04/23 23:07:59 Should this be a scoped_refptr<> instead?
bshe 2015/04/24 14:24:37 Great suggestion! Done.
base::Callback<void(void)> callback_;
@@ -137,7 +138,8 @@ CallbackAnimationObserver::CallbackAnimationObserver(
}
CallbackAnimationObserver::~CallbackAnimationObserver() {
- animator_->RemoveObserver(this);
+ if (animator_)
+ animator_->RemoveObserver(this);
}
void CallbackAnimationObserver::OnLayerAnimationEnded(
@@ -146,11 +148,18 @@ void CallbackAnimationObserver::OnLayerAnimationEnded(
return;
animator_->RemoveObserver(this);
callback_.Run();
+ animator_ = NULL;
}
void CallbackAnimationObserver::OnLayerAnimationAborted(
ui::LayerAnimationSequence* seq) {
animator_->RemoveObserver(this);
+ animator_ = NULL;
+}
+
+bool CallbackAnimationObserver::RequiresNotificationWhenAnimatorDestroyed()
+ const {
+ return true;
}
class WindowBoundsChangeObserver : public aura::WindowObserver {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698