Changeset 195811 in webkit
- Timestamp:
- Jan 29, 2016 8:26:23 AM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r195797 r195811 1 2016-01-29 Mario Sanchez Prada <mario@endlessm.com> 2 3 [GTK] WebProcess crashes when quickly attempting many DnD operations 4 https://bugs.webkit.org/show_bug.cgi?id=138468 5 6 Reviewed by Michael Catanzaro. 7 8 Guard all the new DnD-related code under GTK_CHECK_VERSION #if's to 9 make sure we don't bump the required version of GTK+ up to 3.16, and 10 it's buildable again with GTK+ >= 3.6. 11 12 * UIProcess/gtk/DragAndDropHandler.cpp: 13 (WebKit::DragAndDropHandler::DragAndDropHandler): 14 (WebKit::DragAndDropHandler::startDrag): 15 (WebKit::DragAndDropHandler::fillDragData): 16 (WebKit::DragAndDropHandler::finishDrag): 17 * UIProcess/gtk/DragAndDropHandler.h: 18 1 19 2016-01-28 Antti Koivisto <antti@apple.com> 2 20 -
trunk/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp
r195586 r195811 45 45 DragAndDropHandler::DragAndDropHandler(WebPageProxy& page) 46 46 : m_page(page) 47 #if GTK_CHECK_VERSION(3, 16, 0) 47 48 , m_dragContext(nullptr) 49 #endif 48 50 { 49 51 } … … 112 114 void DragAndDropHandler::startDrag(const DragData& dragData, PassRefPtr<ShareableBitmap> dragImage) 113 115 { 116 #if GTK_CHECK_VERSION(3, 16, 0) 114 117 m_draggingDataObject = adoptRef(dragData.platformData()); 115 116 118 GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::singleton().targetListForDataObject(m_draggingDataObject.get())); 119 #else 120 RefPtr<DataObjectGtk> dataObject = adoptRef(dragData.platformData()); 121 GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::singleton().targetListForDataObject(dataObject.get())); 122 #endif 123 117 124 GUniquePtr<GdkEvent> currentEvent(gtk_get_current_event()); 118 119 125 GdkDragContext* context = gtk_drag_begin(m_page.viewWidget(), targetList.get(), dragOperationToGdkDragActions(dragData.draggingSourceOperationMask()), 120 126 GDK_BUTTON_PRIMARY, currentEvent.get()); 121 127 128 #if GTK_CHECK_VERSION(3, 16, 0) 122 129 // WebCore::EventHandler does not support more than one DnD operation at the same time for 123 130 // a given page, so we should cancel any previous operation whose context we might have … … 126 133 gtk_drag_cancel(m_dragContext.get()); 127 134 m_dragContext = context; 135 #else 136 // We don't have gtk_drag_cancel() in GTK+ < 3.16, so we use the old code. 137 // See https://bugs.webkit.org/show_bug.cgi?id=138468 138 m_draggingDataObjects.set(context, dataObject.get()); 139 #endif 128 140 129 141 if (dragImage) { … … 138 150 void DragAndDropHandler::fillDragData(GdkDragContext* context, GtkSelectionData* selectionData, unsigned info) 139 151 { 152 #if GTK_CHECK_VERSION(3, 16, 0) 140 153 // This can happen when attempting to call finish drag from webkitWebViewBaseDragDataGet() 141 154 // for a obsolete DnD operation that got previously cancelled in startDrag(). … … 145 158 ASSERT(m_draggingDataObject); 146 159 PasteboardHelper::singleton().fillSelectionData(selectionData, info, m_draggingDataObject.get()); 160 #else 161 if (DataObjectGtk* dataObject = m_draggingDataObjects.get(context)) 162 PasteboardHelper::singleton().fillSelectionData(selectionData, info, dataObject); 163 #endif 147 164 } 148 165 149 166 void DragAndDropHandler::finishDrag(GdkDragContext* context) 150 167 { 168 #if GTK_CHECK_VERSION(3, 16, 0) 151 169 // This can happen when attempting to call finish drag from webkitWebViewBaseDragEnd() 152 170 // for a obsolete DnD operation that got previously cancelled in startDrag(). … … 159 177 m_dragContext = nullptr; 160 178 m_draggingDataObject = nullptr; 179 #else 180 if (!m_draggingDataObjects.remove(context)) 181 return; 182 #endif 161 183 162 184 GdkDevice* device = gdk_drag_context_get_device(context); -
trunk/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.h
r195586 r195811 31 31 #include <WebCore/DataObjectGtk.h> 32 32 #include <WebCore/IntPoint.h> 33 #include <gtk/gtk.h> 33 34 #include <wtf/HashMap.h> 34 35 #include <wtf/Noncopyable.h> … … 75 76 76 77 WebPageProxy& m_page; 78 HashMap<GdkDragContext*, std::unique_ptr<DroppingContext>> m_droppingContexts; 79 80 #if GTK_CHECK_VERSION(3, 16, 0) 77 81 GRefPtr<GdkDragContext> m_dragContext; 78 82 RefPtr<WebCore::DataObjectGtk> m_draggingDataObject; 79 HashMap<GdkDragContext*, std::unique_ptr<DroppingContext>> m_droppingContexts; 83 #else 84 // We don't have gtk_drag_cancel() in GTK+ < 3.16, so we use the old code. 85 // See https://bugs.webkit.org/show_bug.cgi?id=138468 86 HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk>> m_draggingDataObjects; 87 #endif 80 88 }; 81 89
Note: See TracChangeset
for help on using the changeset viewer.