summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2023-06-07 22:12:15 +0100
committerLiang Qi <liang.qi@qt.io>2023-08-09 17:49:48 +0800
commit02e9e0a2d4538eb2b3c26d3137228f8f501bcf7f (patch)
treef83ba0356392253878ba2672d881fbb7bf655342
parent5005846f97db146010bac76537f83f33072741c2 (diff)
client: Fix crash on dnd updates after client facing drag ends
A platform drag and a application-facing drag have two different lifespans. The platform drag lasts until all mimedata is transferred and the client receiving the drops marks it as finished. The application facing QDrag lasts until the client deletes it. We can get a crash if we get updates during this time. The drop event is guarded, but not the action negotiation. Fixes: QTBUG-115757 Change-Id: Ib9c047f04d65883105d4cd3f169637d0e038a63f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 22daca49b807fefba58113a06b86df4274e49f62) Reviewed-by: David Edmundson <davidedmundson@kde.org>
-rw-r--r--src/client/qwaylanddatadevice.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index a7014f7a1..6e5600846 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -97,6 +97,9 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte
connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled);
connect(m_dragSource.data(), &QWaylandDataSource::dndResponseUpdated, this, [this](bool accepted, Qt::DropAction action) {
auto drag = static_cast<QWaylandDrag *>(QGuiApplicationPrivate::platformIntegration()->drag());
+ if (!drag->currentDrag()) {
+ return;
+ }
// in old versions drop action is not set, so we guess
if (m_dragSource->version() < 3) {
drag->setResponse(accepted);