Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33635

D&D crash on windows

    XMLWordPrintable

Details

    • Ignore bogus drops in QtGui: 65b26acb7c86b8d278c4edb8308b09520ae09c9f. (dev, 31.1.2014, 5.3), Fix drop site code 4072d68f5756453ab50c1f87be711cbae3e9e2f0, Post to top level only: 9e6bb601319b48b95516afbf11796f4b78e5e0d9 (both dev, 10.2.2014, 5.3)

    Description

      There is a bug that results in access violation in windows DnD implementation.

      The bug is reproduced when doing D&D on a OpenGL-rendered graphics view that sits on a QMainWindow. In this case the view's viewport is a native (not alien) widget.

      When doing D&D really fast, the only events that are received from the OS are drag enter and drag drop.

      In QWindowsOleDropTarget::DragEnter, handleDrag is invoked for QWindowsOleDropTarget::m_window, but in QWindowsOleDropTarget::Drop, the drop operation is invoked for a result of QWindowsOleDropTarget::findDragOverWindow call, which for the case of several native windows returns a window different from QWindowsOleDropTarget::m_window.

      The end result is that QEvent::DragEnter and QEvent::Drop are sent to two different QWidgetWindow}}s. The code in {{QWidgetWindow::handleDropEvent assumes that there was a preceding drag operation, and crashes accessing a cached drop target (QWidgetWindow::m_dragTarget).

      Here is the full stack trace:

      >	Qt5Cored.dll!QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> >::data() Line 132	C++
       	Qt5Cored.dll!qGetPtrHelper<QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > >(const QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > & p) Line 886	C++
       	Qt5Cored.dll!QObject::d_func() Line 118	C++
       	Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 864	C++
       	Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 235	C++
       	Qt5Widgetsd.dll!QWidgetWindow::handleDropEvent(QDropEvent * event) Line 631	C++
       	Qt5Widgetsd.dll!QWidgetWindow::event(QEvent * event) Line 199	C++
       	Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3457	C++
       	Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2878	C++
       	Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 867	C++
       	Qt5Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 232	C++
       	Qt5Guid.dll!QGuiApplicationPrivate::processDrop(QWindow * w, const QMimeData * dropData, const QPoint & p, QFlags<enum Qt::DropAction> supportedActions) Line 2347	C++
       	Qt5Guid.dll!QWindowSystemInterface::handleDrop(QWindow * w, const QMimeData * dropData, const QPoint & p, QFlags<enum Qt::DropAction> supportedActions) Line 601	C++
       	qwindowsd.dll!QWindowsOleDropTarget::Drop(IDataObject * pDataObj, unsigned long grfKeyState, _POINTL pt, unsigned long * pdwEffect) Line 683	C++
       	ole32.dll!CPrivDragDrop::PrivDragDrop(HWND__ * hwnd, tagInterfaceData * pIFDataObject, unsigned long dop, unsigned long grfKeyState, _POINTL ptl, unsigned long * pdwEffects, unsigned long dwSmId, IDataObject * pRealDataObject, HWND__ * hwndSource) Line 960	C++
       	ole32.dll!PrivDragDrop(HWND__ * hWnd, tagDRAGOP dop, void * IDOBuffer, IDataObject * pIDataObject, unsigned long grfKeyState, _POINTL ptl, unsigned long * pdwEffect, HWND__ * hwndSource, void * * phDDInfo) Line 1099	C++
       	ole32.dll!CDropTarget::Drop(IDataObject * pDataObject, unsigned long grfKeyState, _POINTL ptl, unsigned long * pdwEffect) Line 2492	C++
       	ole32.dll!CDragOperation::CompleteDrop() Line 1601	C++
       	ole32.dll!DoDragDrop(IDataObject * pDataObject, IDropSource * pDropSource, unsigned long dwOKEffects, unsigned long * pdwEffect) Line 1964	C++
       	qwindowsd.dll!QWindowsDrag::drag(QDrag * drag) Line 802	C++
       	Qt5Guid.dll!QDragManager::drag(QDrag * o) Line 143	C++
       	Qt5Guid.dll!QDrag::exec(QFlags<enum Qt::DropAction> supportedActions, Qt::DropAction defaultDropAction) Line 282	C++
       	Qt5Widgetsd.dll!QAbstractItemView::startDrag(QFlags<enum Qt::DropAction> supportedActions) Line 3582	C++
       	Qt5Widgetsd.dll!QAbstractItemView::mouseMoveEvent(QMouseEvent * event) Line 1761	C++
       	Qt5Widgetsd.dll!QTreeView::mouseMoveEvent(QMouseEvent * event) Line 1927	C++
       	Qt5Widgetsd.dll!QWidget::event(QEvent * event) Line 7883	C++
       	Qt5Widgetsd.dll!QFrame::event(QEvent * e) Line 534	C++
       	Qt5Widgetsd.dll!QAbstractScrollArea::viewportEvent(QEvent * e) Line 1163	C++
       	Qt5Widgetsd.dll!QAbstractItemView::viewportEvent(QEvent * event) Line 1680	C++
       	Qt5Widgetsd.dll!QTreeView::viewportEvent(QEvent * event) Line 1263	C++
       	Qt5Widgetsd.dll!QAbstractScrollAreaPrivate::viewportEvent(QEvent * event) Line 105	C++
       	Qt5Widgetsd.dll!QAbstractScrollAreaFilter::eventFilter(QObject * o, QEvent * e) Line 121	C++
       	Qt5Cored.dll!QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject * receiver, QEvent * event) Line 963	C++
       	Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3453	C++
       	Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2993	C++
       	Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 867	C++
       	Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 235	C++
       	Qt5Widgetsd.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous) Line 2485	C++
       	Qt5Widgetsd.dll!QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent * event) Line 284	C++
       	Qt5Widgetsd.dll!QGraphicsProxyWidget::mouseMoveEvent(QGraphicsSceneMouseEvent * event) Line 1205	C++
       	Qt5Widgetsd.dll!QGraphicsItem::sceneEvent(QEvent * event) Line 6693	C++
       	Qt5Widgetsd.dll!QGraphicsWidget::sceneEvent(QEvent * event) Line 1232	C++
       	Qt5Widgetsd.dll!QGraphicsScenePrivate::sendEvent(QGraphicsItem * item, QEvent * event) Line 1248	C++
       	Qt5Widgetsd.dll!QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent * mouseEvent) Line 1322	C++
       	Qt5Widgetsd.dll!QGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent) Line 4029	C++
       	Qt5Widgetsd.dll!QGraphicsScene::event(QEvent * event) Line 3362	C++
      

      Attached patch resolves the issue by using QWindowsOleDropTarget::findDragOverWindow in QWindowsOleDropTarget::DragEnter. It may not be a perfect solution, but it has worked for me.

      Attachments

        1. dnd.patch
          4 kB
        2. qtbug33635.zip
          4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            elric Elric
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes