summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleix Pol <aleixpol@kde.org>2019-06-12 16:03:13 +0200
committerJohan Helsing <johan.helsing@qt.io>2019-06-14 06:20:59 +0000
commitaf00b80178138e55be7ea892a118e6357798e0f2 (patch)
treea2f7060ab93c1dd9b498c2d9d5ee40b8d14d83de
parentaf9ec8a76d7e62444fadb518256fc58723fe5186 (diff)
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>
-rw-r--r--src/client/qwaylanddatadevice.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index 300c9de0a..11984f9d3 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -111,7 +111,10 @@ void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon)
if (!origin)
origin = m_display->currentInputDevice()->touchFocus();
- start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial());
+ 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()