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

Unified Diff: ui/views/cocoa/drag_drop_client_mac.mm

Issue 2572473004: Fix Crash in DragDropClientMac::Drop()
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/cocoa/drag_drop_client_mac.mm
diff --git a/ui/views/cocoa/drag_drop_client_mac.mm b/ui/views/cocoa/drag_drop_client_mac.mm
index 9dda333f01be43f1580fc022315501b8f7f162ef..d637f5d9e37ee98f47af4cd3853993224b3ca5e6 100644
--- a/ui/views/cocoa/drag_drop_client_mac.mm
+++ b/ui/views/cocoa/drag_drop_client_mac.mm
@@ -148,11 +148,15 @@ NSDragOperation DragDropClientMac::DragUpdate(id<NSDraggingInfo> sender) {
}
NSDragOperation DragDropClientMac::Drop(id<NSDraggingInfo> sender) {
- int drag_operation = drop_helper_.OnDrop(
- *[data_source_ data], LocationInView([sender draggingLocation]),
- operation_);
+ // OnDrop can optionally delete |this|, so clear data members first.
+ base::scoped_nsobject<CocoaDragDropDataProvider> data_source = data_source_;
+ int operation = operation_;
data_source_.reset();
operation_ = 0;
+
+ int drag_operation = drop_helper_.OnDrop(
+ *[data_source data], LocationInView([sender draggingLocation]),
+ operation);
return ui::DragDropTypes::DragOperationToNSDragOperation(drag_operation);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698