From 4b05247f43d592ce748933963df923d9a40705f8 Mon Sep 17 00:00:00 2001 From: Sigurdur Asgeirsson Date: Mon, 8 Feb 2021 18:36:10 +0000 Subject: [PATCH] Don't crash on reentrant RunMoveLoop call. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: 1173484 Change-Id: Ia75b200d2826586080c26089751bef1d12c8fbce Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2680089 Reviewed-by: Scott Violet Commit-Queue: Sigurður Ásgeirsson Cr-Commit-Position: refs/heads/master@{#851799} --- chrome/browser/ui/views/tabs/tab_drag_controller.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc index 16c3c1e9df8c2..d2ccc2b965237 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc @@ -1397,6 +1397,10 @@ void TabDragController::RunMoveLoop(const gfx::Vector2d& drag_offset) { move_loop_widget_ = GetAttachedBrowserWidget(); DCHECK(move_loop_widget_); + + // RunMoveLoop can be called reentrantly from within another RunMoveLoop, + // in which case the observation is already established. + widget_observation_.Reset(); widget_observation_.Observe(move_loop_widget_); current_state_ = DragState::kDraggingWindow; base::WeakPtr ref(weak_factory_.GetWeakPtr());