Don't crash if we start a drag without dragFocus

Sometimes origin will be nullptr, triggering a crash.

[ChangeLog][QPA plugin] Fixed a crash that sometimes happened when
starting a drag-and-drop operation.

Fixes: QTBUG-76368
Change-Id: I8f4e6b05f073644834c3c72a8307dac5b897f626
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
Aleix Pol 2019-06-12 16:03:13 +02:00 committed by Johan Helsing
parent 4a9a5e2f62
commit 002fade629

View File

@ -111,7 +111,10 @@ void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon)
if (!origin)
origin = m_display->currentInputDevice()->touchFocus();
if (origin)
start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial());
else
qCDebug(lcQpaWayland) << "Couldn't start a drag because the origin window could not be found.";
}
void QWaylandDataDevice::cancelDrag()