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

Unified Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2096003002: Fix crash when InkDropHostView::SetHasInkDrop() is called multiple times (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/views/animation/ink_drop_host_view.cc
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index e6b1e424155d41e75056cdf1744fc2e7e2684fcc..acba512f0b23e5e95260e39b19f96abc78708e87 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -39,6 +39,8 @@ const int InkDropHostView::kInkDropSmallCornerRadius = 2;
// An EventHandler that is guaranteed to be invoked and is not prone to
// InkDropHostView descendents who do not call
// InkDropHostView::OnGestureEvent().
+// Only one instance of this class can exist at any given time. Make sure to
+// delete the old one, if any, *before* instantiating a new one.
sadrul 2016/06/26 03:51:31 You mean only one instance can exist *for a partic
mohsen 2016/06/27 18:59:10 Right. Updated the comment.
//
// TODO(bruthig): Consider getting rid of this class.
class InkDropHostView::InkDropGestureHandler : public ui::EventHandler {
@@ -221,11 +223,11 @@ bool InkDropHostView::ShouldShowInkDropForFocus() const {
}
void InkDropHostView::SetHasInkDrop(bool has_an_ink_drop) {
+ gesture_handler_.reset();
if (has_an_ink_drop) {
ink_drop_.reset(new InkDropImpl(this));
gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get()));
sadrul 2016/06/26 03:51:31 Add a comment here that any existing InkDropGestur
mohsen 2016/06/27 18:59:10 Yes, Added SetInkDrop().
} else {
- gesture_handler_.reset();
ink_drop_.reset(new InkDropStub());
}
}
« 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