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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 1494433003: Fixes a crash when InkDropDelegate gets destroyed after its InkDropHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes a crash when InkDropDelegate gets destroyed after its InkDropHost (delegate owned by a leaf c… Created 5 years 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 | « ui/views/controls/button/custom_button.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index bb4550098ee142bdc6194be9f87886aecb609036..e8ce4a003e394c3ff8f5ae260888f8806ddf8b1c 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -56,6 +56,9 @@ CustomButton* CustomButton::AsCustomButton(views::View* view) {
}
CustomButton::~CustomButton() {
+ // InkDropDelegate needs to be destroyed by now since it may need to call
+ // methods on |this| via InkDropHost.
+ DCHECK(!ink_drop_delegate_);
}
void CustomButton::SetState(ButtonState state) {
@@ -338,6 +341,7 @@ CustomButton::CustomButton(ButtonListener* listener)
is_throbbing_(false),
triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON),
request_focus_on_press_(true),
+ ink_drop_delegate_(nullptr),
notify_action_(NOTIFY_ON_RELEASE) {
hover_animation_.reset(new gfx::ThrobAnimation(this));
hover_animation_->SetSlideDuration(kHoverFadeDurationMs);
@@ -381,11 +385,6 @@ bool CustomButton::ShouldEnterHoveredState() {
return check_mouse_position && IsMouseHovered();
}
-void CustomButton::SetInkDropDelegate(
- scoped_ptr<InkDropDelegate> ink_drop_delegate) {
- ink_drop_delegate_ = ink_drop_delegate.Pass();
-}
-
////////////////////////////////////////////////////////////////////////////////
// CustomButton, View overrides (protected):
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698