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

Unified Diff: ui/views/widget/widget.cc

Issue 819793002: Reland: Fix crash when the source browser window is deleted during a drag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 7f649c04025bffe95c5f1ab444279baf94f77572..a24f781df4d3ba81640a64d935d8547ca5bc183d 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -788,7 +788,14 @@ void Widget::RunShellDrag(View* view,
ui::DragDropTypes::DragEventSource source) {
dragged_view_ = view;
OnDragWillStart();
+
+ WidgetDeletionObserver widget_deletion_observer(this);
native_widget_->RunShellDrag(view, data, location, operation, source);
+
+ // The widget may be destroyed during the drag operation.
+ if (!widget_deletion_observer.IsWidgetAlive())
+ return;
+
// If the view is removed during the drag operation, dragged_view_ is set to
// NULL.
if (view && dragged_view_ == view) {
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698