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

Unified Diff: content/browser/web_contents/web_drag_dest_mac.mm

Issue 2547213002: Cancel drag operation when the tab RenderWidgetHostView does not exist (Mac) (Closed)
Patch Set: Added a blink line Created 4 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 | « content/browser/renderer_host/render_widget_host_input_event_router.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_drag_dest_mac.mm
diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm
index 625df3f1ecf6d60aa7f1306ead3da079e8f30172..ff7abd20eeaf52069ab0c7e0ebcb9e7473be071c 100644
--- a/content/browser/web_contents/web_drag_dest_mac.mm
+++ b/content/browser/web_contents/web_drag_dest_mac.mm
@@ -134,6 +134,12 @@ int GetModifierFlags() {
NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
gfx::Point transformedPt;
+ if (!webContents_->GetRenderWidgetHostView()) {
+ // This could happen when the renderer process for the top-level RWH crashes
+ // (see https://crbug.com/670645).
+ canceled_ = true;
+ return NSDragOperationNone;
+ }
currentRWHForDrag_ =
[self GetRenderWidgetHostAtPoint:viewPoint transformedPt:&transformedPt]
->GetWeakPtr();
@@ -203,6 +209,9 @@ int GetModifierFlags() {
- (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info
view:(NSView*)view {
+ if (canceled_)
+ return NSDragOperationNone;
dcheng 2016/12/03 00:33:07 Seems unusual that this condition is checked twice
EhsanK 2016/12/03 00:36:44 I think draggingEntered could also mutate |cancele
dcheng 2016/12/03 00:49:14 Right, I understand, that was there even before we
EhsanK 2016/12/03 00:59:37 I see your point. I could instead not change cance
dcheng 2016/12/03 01:02:32 Meh, I can't really think of anything better atm.
EhsanK 2016/12/03 01:13:50 I added TODOs (on behalf of paulmeyer@ as well hop
+
// Create the appropriate mouse locations for WebCore. The draggingLocation
// is in window coordinates. Both need to be flipped.
NSPoint windowPoint = [info draggingLocation];
« no previous file with comments | « content/browser/renderer_host/render_widget_host_input_event_router.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698