File: 0071-client-Fix-crash-on-dnd-updates-after-client-facing-.patch

package info (click to toggle)
qtwayland-opensource-src 5.15.17-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 11,108 kB
  • sloc: cpp: 53,691; xml: 9,462; ansic: 187; makefile: 29; sh: 5
file content (37 lines) | stat: -rw-r--r-- 1,704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 4a71f55f3c838ce27f76bdf7356b1caa827f00ec Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Wed, 7 Jun 2023 22:12:15 +0100
Subject: [PATCH] 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>
(cherry picked from commit 22daca49b807fefba58113a06b86df4274e49f62)
---
 src/client/qwaylanddatadevice.cpp | 3 +++
 1 file changed, 3 insertions(+)

--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -138,6 +138,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 (wl_data_source_get_version(m_dragSource->object()) < 3) {
                 drag->setResponse(accepted);