diff --git a/chrome/browser/ui/views/tabs/dragging/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/dragging/tab_drag_controller.cc index 91e4ed439ae7b..ba49c8ff0403b 100644 --- a/chrome/browser/ui/views/tabs/dragging/tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/dragging/tab_drag_controller.cc @@ -1023,11 +1023,23 @@ TabDragController::Liveness TabDragController::DragBrowserToNewTabStrip( #if defined(USE_AURA) // Only Aura windows are gesture consumers. - gfx::NativeView attached_native_view = - GetAttachedBrowserWidget()->GetNativeView(); - GetAttachedBrowserWidget()->GetGestureRecognizer()->TransferEventsTo( - attached_native_view, target_context->GetWidget()->GetNativeView(), - ui::TransferTouchesBehavior::kDontCancel); + { + auto ref = weak_factory_.GetWeakPtr(); + base::WeakAutoReset reentrant_destruction_guard( + ref, &TabDragController::expect_stay_alive_, true); + + gfx::NativeView attached_native_view = + GetAttachedBrowserWidget()->GetNativeView(); + GetAttachedBrowserWidget()->GetGestureRecognizer()->TransferEventsTo( + attached_native_view, target_context->GetWidget()->GetNativeView(), + ui::TransferTouchesBehavior::kDontCancel); + + // If `attached_context_` received a gesture end event, it will have ended + // the drag, destroying `this`. This shouldn't ever happen (preventing this + // scenario is why we pass kDontCancel above) - https://crbug.com/40060514. + CHECK(ref) << "Drag session was ended as part of transferring events to " + "the new tab strip. This should not happen."; + } #endif if (current_state_ == DragState::kDraggingWindow) {