Commit d8322ad2 authored by bshe's avatar bshe Committed by Commit bot

Fix a crash in dtor of CallbackAnimationObserver

It might be possible that animator is destroyed when desstruct CallbackAnimationObserver.
Use a scoped_refptr to make sure it wont happen.

BUG=478016

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

Cr-Commit-Position: refs/heads/master@{#327113}
parent 93d3b10c
......@@ -115,7 +115,7 @@ namespace keyboard {
// KeyboardController.
class CallbackAnimationObserver : public ui::LayerAnimationObserver {
public:
CallbackAnimationObserver(ui::LayerAnimator* animator,
CallbackAnimationObserver(const scoped_refptr<ui::LayerAnimator>& animator,
base::Callback<void(void)> callback);
~CallbackAnimationObserver() override;
......@@ -125,14 +125,15 @@ class CallbackAnimationObserver : public ui::LayerAnimationObserver {
void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override;
void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {}
ui::LayerAnimator* animator_;
scoped_refptr<ui::LayerAnimator> animator_;
base::Callback<void(void)> callback_;
DISALLOW_COPY_AND_ASSIGN(CallbackAnimationObserver);
};
CallbackAnimationObserver::CallbackAnimationObserver(
ui::LayerAnimator* animator, base::Callback<void(void)> callback)
const scoped_refptr<ui::LayerAnimator>& animator,
base::Callback<void(void)> callback)
: animator_(animator), callback_(callback) {
}
......
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