Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog (195811 => 195812)
--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog 2016-01-29 16:26:23 UTC (rev 195811)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/ChangeLog 2016-01-29 16:53:29 UTC (rev 195812)
@@ -1,3 +1,21 @@
+2016-01-29 Mario Sanchez Prada <[email protected]>
+
+ [GTK] WebProcess crashes when quickly attempting many DnD operations
+ https://bugs.webkit.org/show_bug.cgi?id=138468
+
+ Reviewed by Michael Catanzaro.
+
+ Guard all the new DnD-related code under GTK_CHECK_VERSION #if's to
+ make sure we don't bump the required version of GTK+ up to 3.16, and
+ it's buildable again with GTK+ >= 3.6.
+
+ * UIProcess/gtk/DragAndDropHandler.cpp:
+ (WebKit::DragAndDropHandler::DragAndDropHandler):
+ (WebKit::DragAndDropHandler::startDrag):
+ (WebKit::DragAndDropHandler::fillDragData):
+ (WebKit::DragAndDropHandler::finishDrag):
+ * UIProcess/gtk/DragAndDropHandler.h:
+
2016-01-27 Carlos Garcia Campos <[email protected]>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.10.6 release.
Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp (195811 => 195812)
--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp 2016-01-29 16:26:23 UTC (rev 195811)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp 2016-01-29 16:53:29 UTC (rev 195812)
@@ -44,7 +44,9 @@
DragAndDropHandler::DragAndDropHandler(WebPageProxy& page)
: m_page(page)
+#if GTK_CHECK_VERSION(3, 16, 0)
, m_dragContext(nullptr)
+#endif
{
}
@@ -111,20 +113,30 @@
void DragAndDropHandler::startDrag(const DragData& dragData, PassRefPtr<ShareableBitmap> dragImage)
{
+#if GTK_CHECK_VERSION(3, 16, 0)
m_draggingDataObject = adoptRef(dragData.platformData());
+ GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::singleton().targetListForDataObject(m_draggingDataObject.get()));
+#else
+ RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData());
+ GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::singleton().targetListForDataObject(dataObject.get()));
+#endif
- GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::singleton().targetListForDataObject(m_draggingDataObject.get()));
GUniquePtr<GdkEvent> currentEvent(gtk_get_current_event());
-
GdkDragContext* context = gtk_drag_begin(m_page.viewWidget(), targetList.get(), dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()),
GDK_BUTTON_PRIMARY, currentEvent.get());
+#if GTK_CHECK_VERSION(3, 16, 0)
// WebCore::EventHandler does not support more than one DnD operation at the same time for
// a given page, so we should cancel any previous operation whose context we might have
// stored, should we receive a new startDrag event before finishing a previous DnD operation.
if (m_dragContext)
gtk_drag_cancel(m_dragContext.get());
m_dragContext = context;
+#else
+ // We don't have gtk_drag_cancel() in GTK+ < 3.16, so we use the old code.
+ // See https://bugs.webkit.org/show_bug.cgi?id=138468
+ m_draggingDataObjects.set(context, dataObject.get());
+#endif
if (dragImage) {
RefPtr<cairo_surface_t> image(dragImage->createCairoSurface());
@@ -137,6 +149,7 @@
void DragAndDropHandler::fillDragData(GdkDragContext* context, GtkSelectionData* selectionData, unsigned info)
{
+#if GTK_CHECK_VERSION(3, 16, 0)
// This can happen when attempting to call finish drag from webkitWebViewBaseDragDataGet()
// for a obsolete DnD operation that got previously cancelled in startDrag().
if (m_dragContext.get() != context)
@@ -144,10 +157,15 @@
ASSERT(m_draggingDataObject);
PasteboardHelper::singleton().fillSelectionData(selectionData, info, m_draggingDataObject.get());
+#else
+ if (DataObjectGtk* dataObject = m_draggingDataObjects.get(context))
+ PasteboardHelper::singleton().fillSelectionData(selectionData, info, dataObject);
+#endif
}
void DragAndDropHandler::finishDrag(GdkDragContext* context)
{
+#if GTK_CHECK_VERSION(3, 16, 0)
// This can happen when attempting to call finish drag from webkitWebViewBaseDragEnd()
// for a obsolete DnD operation that got previously cancelled in startDrag().
if (m_dragContext.get() != context)
@@ -158,6 +176,10 @@
m_dragContext = nullptr;
m_draggingDataObject = nullptr;
+#else
+ if (!m_draggingDataObjects.remove(context))
+ return;
+#endif
GdkDevice* device = gdk_drag_context_get_device(context);
int x = 0, y = 0;
Modified: releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h (195811 => 195812)
--- releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h 2016-01-29 16:26:23 UTC (rev 195811)
+++ releases/WebKitGTK/webkit-2.10/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h 2016-01-29 16:53:29 UTC (rev 195812)
@@ -30,6 +30,7 @@
#include <WebCore/DataObjectGtk.h>
#include <WebCore/IntPoint.h>
+#include <gtk/gtk.h>
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
@@ -74,9 +75,16 @@
WebCore::DataObjectGtk* requestDragData(GdkDragContext*, const WebCore::IntPoint& position, unsigned time);
WebPageProxy& m_page;
+ HashMap<GdkDragContext*, std::unique_ptr<DroppingContext>> m_droppingContexts;
+
+#if GTK_CHECK_VERSION(3, 16, 0)
GRefPtr<GdkDragContext> m_dragContext;
RefPtr<WebCore::DataObjectGtk> m_draggingDataObject;
- HashMap<GdkDragContext*, std::unique_ptr<DroppingContext>> m_droppingContexts;
+#else
+ // We don't have gtk_drag_cancel() in GTK+ < 3.16, so we use the old code.
+ // See https://bugs.webkit.org/show_bug.cgi?id=138468
+ HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk>> m_draggingDataObjects;
+#endif
};
} // namespace WebKit