- 
    Bug 
- 
    Resolution: Done
- 
    P1: Critical 
- 
    5.12.5, 5.13.1
- 
        3dbc7596a3b7aca37e80f76288d3ab761ddd247a (qt/qtbase/5.13)
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
        }
| For Gerrit Dashboard: QTBUG-78907 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 276640,3 | Drag'n'Drop: fix crash when widgets are destroyed during event handling | 5.13 | qt/qtbase | Status: MERGED | +2 | 0 |