Linux: Fix drag/drop crash in WebCore::DragData::modifierKeyState (issue #875).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1070 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
9ed494e647
commit
868fa28fa1
|
@ -83,6 +83,7 @@ WebDropTarget::WebDropTarget(CefBrowserImpl* browser)
|
|||
: browser_(browser),
|
||||
data_requests_(0),
|
||||
context_(NULL),
|
||||
sent_drag_enter_(false),
|
||||
method_factory_(this) {
|
||||
GtkWidget* widget = browser->UIT_GetWebViewHost()->view_handle();
|
||||
gtk_drag_dest_set(widget, (GtkDestDefaults)0, NULL, 0,
|
||||
|
@ -148,6 +149,10 @@ void WebDropTarget::OnDragLeave(GtkWidget* widget, GdkDragContext* context,
|
|||
context_ = NULL;
|
||||
drop_data_.reset();
|
||||
|
||||
// Don't send the drag leave if we didn't send the drag enter.
|
||||
if (!sent_drag_enter_)
|
||||
return;
|
||||
|
||||
// Sometimes we get a drag-leave event before getting a drag-data-received
|
||||
// event. In that case, we don't want to bother the renderer with a
|
||||
// DragLeave event.
|
||||
|
@ -258,6 +263,7 @@ void WebDropTarget::OnDragDataReceived(GtkWidget* widget,
|
|||
if (handler->OnDragEnter(browser_, data,
|
||||
(cef_drag_operations_mask_t)_mask(context))) {
|
||||
operation = WebDragOperationNone;
|
||||
sent_drag_enter_ = false;
|
||||
gdk_drag_status(context,
|
||||
(GdkDragAction)DragDropTypes::DragOperationToGdkDragAction(
|
||||
operation),
|
||||
|
@ -270,6 +276,7 @@ void WebDropTarget::OnDragDataReceived(GtkWidget* widget,
|
|||
gtk_widget_translate_coordinates(gtk_widget_get_toplevel(widget), widget,
|
||||
x, y, &widget_x, &widget_y);
|
||||
WebView* webview = getView();
|
||||
sent_drag_enter_ = true;
|
||||
operation = webview->dragTargetDragEnter(drop_data_->ToDragData(),
|
||||
WebPoint(x, y),
|
||||
WebPoint(widget_x, widget_y),
|
||||
|
|
|
@ -45,6 +45,7 @@ class WebDropTarget : public base::RefCounted<WebDropTarget> {
|
|||
bool entered_;
|
||||
int data_requests_;
|
||||
GdkDragContext* context_;
|
||||
bool sent_drag_enter_;
|
||||
base::WeakPtrFactory<WebDropTarget> method_factory_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue