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

[REG: 5.11 -> 5.12]: Dragging can sometimes crash

    XMLWordPrintable

    Details

    • Commits:
      3dbc7596a3b7aca37e80f76288d3ab761ddd247a (qt/qtbase/5.13)

      Description

      Changes made to QWidgetWindow::handleDragMoveEvent in f8944a7f07112c85dc4f66848cabb490514cd28e can lead to nullptr being passed to forwardEvent which causes a crash.

      At least m_dragTarget can be set as a nullptr, then few lines later it is passed to forwardEvent() in here:

              } else {
                  if (m_dragTarget) { // Send DragLeave to previous
                      QDragLeaveEvent leaveEvent;
                      QGuiApplication::forwardEvent(m_dragTarget, &leaveEvent, event);
                      m_dragTarget = nullptr; <-- could be set to nullptr from here
                  }
                  // Send DragEnter to new widget.
                  handleDragEnterEvent(static_cast<QDragEnterEvent*>(event), widget);
                  // Handling 'DragEnter' should suffice for the application.
                  translated.setDropAction(event->dropAction());
                  translated.setAccepted(event->isAccepted());
                  // The drag enter event is always immediately followed by a drag move event,
                  // see QDragEnterEvent documentation.
                  QGuiApplication::forwardEvent(m_dragTarget, &translated, event); <--- HERE
              }
      

        Attachments

        1. callstack.txt
          17 kB
        2. cancelDrag.cpp
          3 kB
        For Gerrit Dashboard: QTBUG-78907
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            yulong.bai Bai Yulong
            Reporter:
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes