Changeset 269620 in webkit
- Timestamp:
- Nov 10, 2020 1:03:04 AM (3 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r269618 r269620 1 2020-11-10 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Crash in WebKit::DropTarget::drop 4 https://bugs.webkit.org/show_bug.cgi?id=217482 5 6 Reviewed by Michael Catanzaro. 7 8 If we don't have selection data when drop is called, just return early to let leave continue. Also change 9 accept() to receive the drop context and position to be set after leaving any previous operation. 10 11 * UIProcess/API/gtk/DropTarget.h: 12 * UIProcess/API/gtk/DropTargetGtk3.cpp: 13 (WebKit::DropTarget::DropTarget): 14 (WebKit::DropTarget::accept): 15 (WebKit::DropTarget::drop): 16 * UIProcess/API/gtk/DropTargetGtk4.cpp: 17 (WebKit::DropTarget::DropTarget): 18 (WebKit::DropTarget::accept): 19 1 20 2020-11-10 Carlos Garcia Campos <cgarcia@igalia.com> 2 21 -
trunk/Source/WebKit/UIProcess/API/gtk/DropTarget.h
r262680 r269620 40 40 #if USE(GTK4) 41 41 typedef struct _GdkDrop GdkDrop; 42 using PlatformDropContext = GdkDrop; 42 43 #else 43 44 typedef struct _GdkDragContext GdkDragContext; 44 45 typedef struct _GtkSelectionData GtkSelectionData; 46 using PlatformDropContext = GdkDragContext; 45 47 #endif 46 48 … … 58 60 59 61 private: 60 void accept( unsigned = 0);62 void accept(PlatformDropContext*, Optional<WebCore::IntPoint> = WTF::nullopt, unsigned = 0); 61 63 void enter(WebCore::IntPoint&&, unsigned = 0); 62 64 void update(WebCore::IntPoint&&, unsigned = 0); -
trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp
r269505 r269620 60 60 auto& drop = *static_cast<DropTarget*>(userData); 61 61 if (drop.m_drop != context) { 62 drop.m_drop = context; 63 drop.m_position = IntPoint(x, y); 64 drop.accept(time); 62 drop.accept(context, IntPoint(x, y), time); 65 63 } else if (drop.m_drop == context) 66 64 drop.update({ x, y }, time); … … 98 96 } 99 97 100 void DropTarget::accept( unsigned time)98 void DropTarget::accept(GdkDragContext* drop, Optional<WebCore::IntPoint> position, unsigned time) 101 99 { 102 100 if (m_leaveTimer.isActive()) { … … 105 103 } 106 104 105 m_drop = drop; 106 m_position = position; 107 107 m_dataRequestCount = 0; 108 108 m_selectionData = WTF::nullopt; … … 260 260 void DropTarget::drop(IntPoint&& position, unsigned time) 261 261 { 262 // If we don't have data at this point, allow the leave timer to fire, ending the drop operation. 263 if (!m_selectionData) 264 return; 265 262 266 if (m_leaveTimer.isActive()) 263 267 m_leaveTimer.stop(); -
trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk4.cpp
r265650 r269620 55 55 g_signal_connect(target, "accept", G_CALLBACK(+[](GtkDropTargetAsync*, GdkDrop* gdkDrop, gpointer userData) -> gboolean { 56 56 auto& drop = *static_cast<DropTarget*>(userData); 57 drop.m_drop = gdkDrop; 58 drop.accept(); 57 drop.accept(gdkDrop); 59 58 return TRUE; 60 59 }), this); … … 103 102 } 104 103 105 void DropTarget::accept(unsigned) 106 { 107 m_position = WTF::nullopt; 104 void DropTarget::accept(GdkDrop* drop, Optional<WebCore::IntPoint> position, unsigned) 105 { 106 m_drop = drop; 107 m_position = position; 108 108 m_selectionData = SelectionData(); 109 109 m_dataRequestCount = 0;
Note: See TracChangeset
for help on using the changeset viewer.