diff options
author | David Edmundson <davidedmundson@kde.org> | 2023-06-07 22:12:15 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2023-06-08 14:30:19 +0000 |
commit | 22daca49b807fefba58113a06b86df4274e49f62 (patch) | |
tree | 9d460b7c82d01614b337856a24b032e9478ab3cc | |
parent | 99aed7df9a7267216c4f99e900dec6265b886d2c (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.
Pick-to: 6.6
Change-Id: Ib9c047f04d65883105d4cd3f169637d0e038a63f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r-- | src/client/qwaylanddatadevice.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index e9d82100f..80a9a7739 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -101,6 +101,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); |