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

Drag and Drop (DND) leads to crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 4.7.4
    • GUI: Drag and Drop
    • None

    Description

      A crash occurs in QDragManager::drag(QDrag ). The stacktrace is pasted in below, and is also included in the attached zip file. The crash occurs because the QDragManager::drag(QDrag *) function is entered recursively (it is entered twice). In the stacktrace below you cannot see this, because the crash happens after exiting the innermost invocation of QDragManager::drag(QDrag *). It doesn't look like the QDragManager::drag(QDrag) code was designed to be entered twice. It is entered twice, because a WM_MOUSEMOVE event is unexpectedly (to me) delivered while dragging, and this mouse move event is funneled back to the code that started the drag, in this case in QAbstractItemView::mouseMoveEvent(QMouseEvent * event) which starts another drag!

      To reproduce the problem follow these steps:

      • build the attached sample on Windows against qt 4.7.4 (probably any version will fail)
      • Launch the application
      • Move the mouse cursor to the left edge of the window - a sidebar should pop out
      • Drag one of the "Hello x" items and out into the central widget and let the sidebare hide itself
      • Drop it on the central widget
      • This in many cases leads to a crash. If it fails to do so, try again and try to move the mouse over and away from the sidebar to make it collapse and expand a few times before dropping on the central widget.

      It is on the drop (mouse button release) that the crash occurs. It is when the sidebar hides that the spurious mouse move event is delivered causing the inner drag operation to start, but things continue to work until control returns to the first invocation of QDragManager::drag(QDrag*).

      > QtGuid4.dll!QDragManager::drag(QDrag * o) Line 971 + 0x8 bytes C++
      QtGuid4.dll!QDrag::exec(QFlags<enum Qt::DropAction> supportedActions, Qt::DropAction defaultDropAction) Line 286 + 0xc bytes C++
      QtGuid4.dll!QAbstractItemView::startDrag(QFlags<enum Qt::DropAction> supportedActions) Line 3450 + 0x1b bytes C++
      QtGuid4.dll!QAbstractItemView::mouseMoveEvent(QMouseEvent * event) Line 1712 C++
      QtGuid4.dll!QTreeView::mouseMoveEvent(QMouseEvent * event) Line 1904 C++
      QtGuid4.dll!QWidget::event(QEvent * event) Line 8281 C++
      QtGuid4.dll!QFrame::event(QEvent * e) Line 557 + 0xc bytes C++
      QtGuid4.dll!QAbstractScrollArea::viewportEvent(QEvent * e) Line 1043 + 0xc bytes C++
      QtGuid4.dll!QAbstractItemView::viewportEvent(QEvent * event) Line 1629 C++
      QtGuid4.dll!QTreeView::viewportEvent(QEvent * event) Line 1257 C++
      QtGuid4.dll!QAbstractScrollAreaPrivate::viewportEvent(QEvent * event) Line 100 + 0x28 bytes C++
      QtGuid4.dll!QAbstractScrollAreaFilter::eventFilter(QObject * o, QEvent * e) Line 116 + 0x29 bytes C++
      QtCored4.dll!QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject * receiver, QEvent * event) Line 902 + 0x15 bytes C++
      QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 4477 + 0x11 bytes C++
      QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 4042 + 0x2f bytes C++
      QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 787 + 0x15 bytes C++
      QtCored4.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 218 + 0x38 bytes C++
      QtGuid4.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous) Line 3139 + 0xe bytes C++
      QtGuid4.dll!QETWidget::translateMouseEvent(const tagMSG & msg) Line 3338 + 0x2a bytes C++
      QtGuid4.dll!QtWndProc(HWND__ * hwnd, unsigned int message, unsigned int wParam, long lParam) Line 1676 + 0xc bytes C++
      user32.dll!_InternalCallWinProc@20() + 0x23 bytes
      user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes
      user32.dll!_DispatchMessageWorker@8() + 0xed bytes
      user32.dll!_DispatchMessageW@4() + 0xf bytes
      QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 810 C++
      QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1170 + 0x15 bytes C++
      QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 150 C++
      QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 201 + 0x2d bytes C++
      QtCored4.dll!QCoreApplication::exec() Line 1064 + 0x15 bytes C++
      QtGuid4.dll!QApplication::exec() Line 3756 C++
      dnd.exe!main(int argc, char * * argv) Line 71 + 0x6 bytes C++
      dnd.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * __formal, int cmdShow) Line 131 + 0x12 bytes C++
      dnd.exe!__tmainCRTStartup() Line 547 + 0x2c bytes C
      dnd.exe!WinMainCRTStartup() Line 371 C
      kernel32.dll!@BaseThreadInitThunk@12() + 0x12 bytes
      ntdll.dll!___RtlUserThreadStart@8() + 0x27 bytes
      ntdll.dll!__RtlUserThreadStart@8() + 0x1b bytes

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            ts Thomas Sondergaard
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes