From 9ed494e647ae5647a9e853f868e2974f94c498c2 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 30 Jan 2013 16:38:12 +0000 Subject: [PATCH] Linux: Fix drag/drop crash in WebCore::DragData::modifierKeyState (issue #875). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1066 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef1/libcef/web_drop_target_gtk.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cef1/libcef/web_drop_target_gtk.cc b/cef1/libcef/web_drop_target_gtk.cc index b26a979c7..481f7c08d 100644 --- a/cef1/libcef/web_drop_target_gtk.cc +++ b/cef1/libcef/web_drop_target_gtk.cc @@ -147,6 +147,17 @@ void WebDropTarget::OnDragLeave(GtkWidget* widget, GdkDragContext* context, guint time) { context_ = NULL; drop_data_.reset(); + + // 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. + if (data_requests_ != 0) + return; + + // When GTK sends us a drag-drop signal, it is shortly (and synchronously) + // preceded by a drag-leave. The renderer doesn't like getting the signals + // in this order so delay telling it about the drag-leave till we are sure + // we are not getting a drop as well. MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&WebDropTarget::DragLeave, method_factory_.GetWeakPtr())); }