Chromium Code Reviews| Index: content/browser/web_contents/web_contents_view_aura.cc |
| diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc |
| index 091cb0e4712f47a583e7b9c0df27ca3e7a58d3c0..aaa57f020ab1567c41b44070dc8102acc7ac60e7 100644 |
| --- a/content/browser/web_contents/web_contents_view_aura.cc |
| +++ b/content/browser/web_contents/web_contents_view_aura.cc |
| @@ -550,7 +550,8 @@ void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { |
| rwhv->SetSize(size); |
| } |
| -void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { |
| +void WebContentsViewAura::EndDrag(RenderWidgetHost* source_rwh, |
| + blink::WebDragOperationsMask ops) { |
| if (!web_contents_) |
| return; |
| @@ -566,7 +567,9 @@ void WebContentsViewAura::EndDrag(blink::WebDragOperationsMask ops) { |
| // the coordinates local to |drag_start_rwh_|? See crbug.com/647249. |
| web_contents_->DragSourceEndedAt(client_loc.x(), client_loc.y(), |
| screen_loc.x(), screen_loc.y(), ops, |
| - drag_start_rwh_.get()); |
| + source_rwh); |
| + |
| + web_contents_->SystemDragEnded(source_rwh); |
| } |
| void WebContentsViewAura::InstallOverscrollControllerDelegate( |
| @@ -896,7 +899,12 @@ void WebContentsViewAura::StartDragging( |
| return; |
| } |
| - drag_start_rwh_ = source_rwh->GetWeakPtr(); |
| + // Grab a weak pointer to the RenderWidgetHost, since it can be destroyed |
| + // during the drag and drop nested message loop in StartDragAndDrop. |
| + // For example, the RenderWidgetHost can be deleted if a cross-proces transfer |
|
dcheng
2016/12/01 21:16:31
Nit: proces => process
lfg
2016/12/01 21:21:32
Done.
|
| + // happens while dragging, since the RenderWidgetHost is deleted in that case. |
|
dcheng
2016/12/01 21:16:31
Can it be more mundane than that? What if that sub
lfg
2016/12/01 21:21:32
Yes, but this can only happen with OOPIFs. The onl
|
| + base::WeakPtr<RenderWidgetHostImpl> source_rwh_weak_ptr = |
| + source_rwh->GetWeakPtr(); |
| ui::TouchSelectionController* selection_controller = GetSelectionController(); |
| if (selection_controller) |
| @@ -940,8 +948,7 @@ void WebContentsViewAura::StartDragging( |
| return; |
| } |
| - EndDrag(ConvertToWeb(result_op)); |
| - web_contents_->SystemDragEnded(source_rwh); |
| + EndDrag(source_rwh_weak_ptr.get(), ConvertToWeb(result_op)); |
| } |
| void WebContentsViewAura::UpdateDragCursor(blink::WebDragOperation operation) { |