Commit 986e3295 authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Chromium LUCI CQ

Fix nullptr access in OnWidgetDestroyed.

Bug: 1155660, 1145565
Change-Id: Ib7ce976d409169daeeda57a056ef71c655d1b29f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576013Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Auto-Submit: Sigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834331}
parent b0d2bf96
...@@ -413,8 +413,7 @@ TabDragController::~TabDragController() { ...@@ -413,8 +413,7 @@ TabDragController::~TabDragController() {
if (g_tab_drag_controller == this) if (g_tab_drag_controller == this)
g_tab_drag_controller = nullptr; g_tab_drag_controller = nullptr;
if (widget_observation_.IsObserving()) widget_observation_.Reset();
widget_observation_.RemoveObservation();
if (is_dragging_window()) if (is_dragging_window())
GetAttachedBrowserWidget()->EndMoveLoop(); GetAttachedBrowserWidget()->EndMoveLoop();
...@@ -690,8 +689,7 @@ void TabDragController::OnWidgetBoundsChanged(views::Widget* widget, ...@@ -690,8 +689,7 @@ void TabDragController::OnWidgetBoundsChanged(views::Widget* widget,
} }
void TabDragController::OnWidgetDestroyed(views::Widget* widget) { void TabDragController::OnWidgetDestroyed(views::Widget* widget) {
DCHECK(widget_observation_.IsObservingSource(widget)); widget_observation_.Reset();
widget_observation_.RemoveObservation();
} }
void TabDragController::OnSourceTabStripEmpty() { void TabDragController::OnSourceTabStripEmpty() {
...@@ -883,8 +881,7 @@ TabDragController::DragBrowserToNewTabStrip(TabDragContext* target_context, ...@@ -883,8 +881,7 @@ TabDragController::DragBrowserToNewTabStrip(TabDragContext* target_context,
// results in a move). That'll cause all sorts of problems. Reset the // results in a move). That'll cause all sorts of problems. Reset the
// observer so we don't get notified and process the event. // observer so we don't get notified and process the event.
#if BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH)
if (widget_observation_.IsObservingSource(move_loop_widget_)) widget_observation_.Reset();
widget_observation_.RemoveObservation();
move_loop_widget_ = nullptr; move_loop_widget_ = nullptr;
#endif // BUILDFLAG(IS_CHROMEOS_ASH) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
views::Widget* browser_widget = GetAttachedBrowserWidget(); views::Widget* browser_widget = GetAttachedBrowserWidget();
......
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