Title: [241659] trunk/Source/WebKit
Revision
241659
Author
carlo...@webkit.org
Date
2019-02-18 01:12:48 -0800 (Mon, 18 Feb 2019)

Log Message

[GTK] Crash while filling selection data during drag and drop
https://bugs.webkit.org/show_bug.cgi?id=194698

Reviewed by Michael Catanzaro.

I can't reproduce this, but it seems that m_draggingSelectionData is nullptr in fillDragData(). That can happen
when startDrag cancels a previous DND operation, because the new m_draggingSelectionData is set before the
current DND operation is cancelled, which sets it to nullptr.

* UIProcess/gtk/DragAndDropHandler.cpp:
(WebKit::DragAndDropHandler::startDrag): Finish the previous operation before setting m_draggingSelectionData.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (241658 => 241659)


--- trunk/Source/WebKit/ChangeLog	2019-02-18 06:49:01 UTC (rev 241658)
+++ trunk/Source/WebKit/ChangeLog	2019-02-18 09:12:48 UTC (rev 241659)
@@ -1,3 +1,17 @@
+2019-02-18  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] Crash while filling selection data during drag and drop
+        https://bugs.webkit.org/show_bug.cgi?id=194698
+
+        Reviewed by Michael Catanzaro.
+
+        I can't reproduce this, but it seems that m_draggingSelectionData is nullptr in fillDragData(). That can happen
+        when startDrag cancels a previous DND operation, because the new m_draggingSelectionData is set before the
+        current DND operation is cancelled, which sets it to nullptr.
+
+        * UIProcess/gtk/DragAndDropHandler.cpp:
+        (WebKit::DragAndDropHandler::startDrag): Finish the previous operation before setting m_draggingSelectionData.
+
 2019-02-17  Youenn Fablet  <you...@apple.com>
 
         https://device.login.microsoftonline.com is hanging on STP75

Modified: trunk/Source/WebKit/UIProcess/gtk/DragAndDropHandler.cpp (241658 => 241659)


--- trunk/Source/WebKit/UIProcess/gtk/DragAndDropHandler.cpp	2019-02-18 06:49:01 UTC (rev 241658)
+++ trunk/Source/WebKit/UIProcess/gtk/DragAndDropHandler.cpp	2019-02-18 09:12:48 UTC (rev 241659)
@@ -107,6 +107,14 @@
 void DragAndDropHandler::startDrag(Ref<SelectionData>&& selection, DragOperation dragOperation, RefPtr<ShareableBitmap>&& dragImage)
 {
 #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 = nullptr;
+    }
+
     m_draggingSelectionData = WTFMove(selection);
     GRefPtr<GtkTargetList> targetList = PasteboardHelper::singleton().targetListForSelectionData(*m_draggingSelectionData);
 #else
@@ -119,11 +127,6 @@
         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.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to