Commit 4677416d authored by Taylor Bergquist's avatar Taylor Bergquist Committed by Commit Bot

Handle drags ending while being initialized.

Tab drag sessions need mouse capture to function; losing capture
therefore ends the drag. There are, evidently, some cases where
SetCapture() can cause the drag session to lose capture, thereby
ending the drag as it's beginning.

Bug: 964322
Change-Id: I6bcd53f04aefb7461e6c28abf1085df1a012545a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817211
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698687}
parent 75110724
...@@ -488,8 +488,14 @@ void TabDragController::Init(TabDragContext* source_context, ...@@ -488,8 +488,14 @@ void TabDragController::Init(TabDragContext* source_context,
// Gestures don't automatically do a capture. We don't allow multiple drags at // Gestures don't automatically do a capture. We don't allow multiple drags at
// the same time, so we explicitly capture. // the same time, so we explicitly capture.
if (event_source == EVENT_SOURCE_TOUCH) if (event_source == EVENT_SOURCE_TOUCH) {
// Taking capture may cause capture to be lost, ending the drag and
// destroying |this|.
base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr());
SetCapture(source_context_); SetCapture(source_context_);
if (!ref)
return;
}
window_finder_ = std::make_unique<WindowFinder>(); window_finder_ = std::make_unique<WindowFinder>();
} }
......
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