Sync from SUSE:SLFO:Main qt6-wayland revision 4f8d7924e8fbd4099c5a36192dee7b55

This commit is contained in:
Adrian Schröter 2025-02-25 17:38:48 +01:00
parent 2b0d3a2544
commit cfd0389108
6 changed files with 14 additions and 299 deletions

View File

@ -1,263 +0,0 @@
From 24002ac6cbd01dbde4944b63c1f7c87ed2bd72b5 Mon Sep 17 00:00:00 2001
From: David Redondo <qt@david-redondo.de>
Date: Fri, 22 Nov 2024 10:56:41 +0100
Subject: [PATCH] client: Redo management of tablet object proxies
Since 5af836aea3bb91a9f388e565415dc33b2fde4577 tools and pads can sometimes
be parented to tablets. When a tablet is unplugged sometimes the remove
event for the tablet can be sent before the remove events for the pad.
Deleting the tablet will also delete the pad but not the pad proxy,
resulting in a crash when the pad remove event is received.
This moves destruction of the wayland proxies which makes everything much
simpler as not every location that deletes those objects needs to call
destroy and fixes the described problem.
Change-Id: I0aaeda3d3996251e411229b5e97aa1ce0bce43ac
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 1f76835d1805d9b1c25c136a19c1101f19cc2259)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
src/client/qwaylandtabletv2.cpp | 24 +++++----
src/client/qwaylandtabletv2_p.h | 4 +-
tests/auto/client/tabletv2/tst_tabletv2.cpp | 60 +++++++++++++++++----
3 files changed, 67 insertions(+), 21 deletions(-)
diff --git a/src/client/qwaylandtabletv2.cpp b/src/client/qwaylandtabletv2.cpp
index 305aae50..c3f665df 100644
--- a/src/client/qwaylandtabletv2.cpp
+++ b/src/client/qwaylandtabletv2.cpp
@@ -185,12 +185,6 @@ QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWa
QWaylandTabletSeatV2::~QWaylandTabletSeatV2()
{
- for (auto *tablet : m_tablets)
- tablet->destroy();
- for (auto *tool : m_tools)
- tool->destroy();
- for (auto *pad : m_pads)
- pad->destroy();
qDeleteAll(m_tablets);
qDeleteAll(m_tools);
qDeleteAll(m_deadTools);
@@ -252,6 +246,11 @@ QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatN
d->seatName = seatName;
}
+QWaylandTabletV2::~QWaylandTabletV2()
+{
+ destroy();
+}
+
void QWaylandTabletV2::zwp_tablet_v2_name(const QString &name)
{
QPointingDevicePrivate *d = QPointingDevicePrivate::get(this);
@@ -290,7 +289,6 @@ void QWaylandTabletSeatV2::toolRemoved(QWaylandTabletToolV2 *tool)
void QWaylandTabletV2::zwp_tablet_v2_removed()
{
- destroy();
deleteLater();
}
@@ -314,7 +312,10 @@ QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::z
#endif
}
-QWaylandTabletToolV2::~QWaylandTabletToolV2() = default;
+QWaylandTabletToolV2::~QWaylandTabletToolV2()
+{
+ destroy();
+}
void QWaylandTabletToolV2::zwp_tablet_tool_v2_type(uint32_t tool_type)
{
@@ -408,7 +409,6 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_done()
void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed()
{
- destroy();
m_tabletSeat->toolRemoved(this);
}
@@ -600,6 +600,11 @@ QWaylandTabletPadV2::QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad)
{
}
+QWaylandTabletPadV2::~QWaylandTabletPadV2()
+{
+ destroy();
+}
+
void QWaylandTabletPadV2::zwp_tablet_pad_v2_path(const QString &path)
{
QPointingDevicePrivate *d = QPointingDevicePrivate::get(this);
@@ -619,7 +624,6 @@ void QWaylandTabletPadV2::zwp_tablet_pad_v2_done()
void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed()
{
- destroy();
delete this;
}
diff --git a/src/client/qwaylandtabletv2_p.h b/src/client/qwaylandtabletv2_p.h
index 94b687ee..f0d7cd18 100644
--- a/src/client/qwaylandtabletv2_p.h
+++ b/src/client/qwaylandtabletv2_p.h
@@ -83,6 +83,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public Q
Q_OBJECT
public:
explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatName);
+ ~QWaylandTabletV2();
protected:
// callbacks which act as setters
@@ -98,7 +99,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, publ
Q_OBJECT
public:
QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool);
- ~QWaylandTabletToolV2() override;
+ ~QWaylandTabletToolV2();
void updateCursor();
@@ -181,6 +182,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, publi
Q_OBJECT
public:
explicit QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad);
+ ~QWaylandTabletPadV2();
protected:
// void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override;
diff --git a/tests/auto/client/tabletv2/tst_tabletv2.cpp b/tests/auto/client/tabletv2/tst_tabletv2.cpp
index 85df099f..d5c2ccb3 100644
--- a/tests/auto/client/tabletv2/tst_tabletv2.cpp
+++ b/tests/auto/client/tabletv2/tst_tabletv2.cpp
@@ -186,9 +186,9 @@ public:
QList<TabletV2 *> m_tablets;
QList<TabletV2 *> m_tabletsWaitingForDestroy;
QList<TabletToolV2 *> m_tools;
- QList<TabletToolV2 *> m_toolsWaitingForDestroy;
+ QList<TabletToolV2::Resource *> m_toolsWaitingForDestroy;
QList<TabletPadV2 *> m_pads;
- QList<TabletPadV2 *> m_padsWaitingForDestroy;
+ QList<TabletPadV2::Resource *> m_padsWaitingForDestroy;
protected:
void zwp_tablet_seat_v2_bind_resource(Resource *resource) override
@@ -274,11 +274,12 @@ void TabletV2::zwp_tablet_v2_destroy(QtWaylandServer::zwp_tablet_v2::Resource *r
void TabletToolV2::sendRemoved()
{
- for (auto *resource : resourceMap())
+ for (auto *resource : resourceMap()) {
zwp_tablet_tool_v2_send_removed(resource->handle);
+ m_tabletSeat->m_toolsWaitingForDestroy.append(resource);
+ }
bool removed = m_tabletSeat->m_tools.removeOne(this);
QVERIFY(removed);
- m_tabletSeat->m_toolsWaitingForDestroy.append(this);
}
uint TabletToolV2::sendProximityIn(TabletV2 *tablet, Surface *surface)
@@ -333,26 +334,25 @@ uint TabletToolV2::sendFrame()
void TabletToolV2::zwp_tablet_tool_v2_destroy(QtWaylandServer::zwp_tablet_tool_v2::Resource *resource)
{
if (m_tabletSeat) {
- bool removed = m_tabletSeat->m_toolsWaitingForDestroy.removeOne(this);
- QVERIFY(removed);
+ m_tabletSeat->m_toolsWaitingForDestroy.removeOne(resource);
}
wl_resource_destroy(resource->handle);
}
void TabletPadV2::sendRemoved()
{
- for (auto *resource : resourceMap())
+ for (auto *resource : resourceMap()) {
zwp_tablet_pad_v2_send_removed(resource->handle);
+ m_tabletSeat->m_padsWaitingForDestroy.append(resource);
+ }
bool removed = m_tabletSeat->m_pads.removeOne(this);
QVERIFY(removed);
- m_tabletSeat->m_padsWaitingForDestroy.append(this);
}
void TabletPadV2::zwp_tablet_pad_v2_destroy(QtWaylandServer::zwp_tablet_pad_v2::Resource *resource)
{
if (m_tabletSeat) {
- bool removed = m_tabletSeat->m_padsWaitingForDestroy.removeOne(this);
- QVERIFY(removed);
+ m_tabletSeat->m_padsWaitingForDestroy.removeOne(resource);
}
wl_resource_destroy(resource->handle);
}
@@ -405,6 +405,8 @@ private slots:
void destroysTablet();
void destroysTool();
void destroysPad();
+ void removeTabletBeforeTool();
+ void removeTabletBeforePad();
void proximityEvents();
void moveEvent();
void pointerType_data();
@@ -502,12 +504,14 @@ void tst_tabletv2::destroysTool()
{
QCOMPOSITOR_TRY_VERIFY(tabletSeat());
exec([&] {
+ tabletSeat()->addTablet();
tabletSeat()->addTool();
});
QCOMPOSITOR_TRY_VERIFY(tabletTool());
exec([&] {
tabletTool()->sendRemoved();
+ tablet()->sendRemoved();
});
QCOMPOSITOR_TRY_VERIFY(!tabletTool());
@@ -530,6 +534,42 @@ void tst_tabletv2::destroysPad()
QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty());
}
+void tst_tabletv2::removeTabletBeforeTool()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addTool();
+ });
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ QCOMPOSITOR_TRY_VERIFY(tabletTool());
+
+ exec([&] { tablet()->sendRemoved(); });
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty());
+
+ exec([&] { tabletTool()->sendRemoved(); });
+ QCOMPOSITOR_TRY_VERIFY(!tabletTool());
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_toolsWaitingForDestroy.empty());
+}
+
+void tst_tabletv2::removeTabletBeforePad()
+{
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
+ tabletSeat()->addTablet();
+ tabletSeat()->addPad();
+ });
+ QCOMPOSITOR_TRY_VERIFY(tablet());
+ QCOMPOSITOR_TRY_VERIFY(tabletPad());
+
+ exec([&] { tablet()->sendRemoved(); });
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty());
+
+ exec([&] { tabletPad()->sendRemoved(); });
+ QCOMPOSITOR_TRY_VERIFY(!tabletPad());
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty());
+}
+
void tst_tabletv2::proximityEvents()
{
ProximityFilter filter;
--
2.47.1

View File

@ -1,25 +0,0 @@
From 6f87a84b8e72c3676ee9cf7190b8ae1f82387353 Mon Sep 17 00:00:00 2001
From: Heng Liu <liuhenga@uniontech.com>
Date: Fri, 25 Oct 2024 10:17:45 +0800
Subject: [PATCH] fix crash when attach differ shellsurface to the same shellsurfaceitem
Change shellSurface from a raw pointer to a QPointer to prevent
crash caused by accessing the wild pointer when shellSurface is destroyed
Pick-to: 6.8
Change-Id: Iabf25ce9e3fab416b5b927bf768e94398516a710
---
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
index 46e5f65..10b10a0 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
@@ -41,7 +41,7 @@
void lower() override;
QWaylandQuickShellIntegration *m_shellIntegration = nullptr;
- QWaylandShellSurface *m_shellSurface = nullptr;
+ QPointer<QWaylandShellSurface> m_shellSurface = nullptr;
QQuickItem *m_moveItem = nullptr;
bool m_autoCreatePopupItems = true;
bool staysOnTop = false;

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Jan 31 10:23:02 UTC 2025 - Christophe Marin <christophe@krop.fr>
- Update to 6.8.2
https://www.qt.io/blog/qt-6.8.2-released
- Drop patches, merged upstream:
* 0001-fix-crash-issue.patch
* 0001-client-Redo-management-of-tablet-object-proxies.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Dec 2 13:02:16 UTC 2024 - Christophe Marin <christophe@krop.fr> Mon Dec 2 13:02:16 UTC 2024 - Christophe Marin <christophe@krop.fr>

View File

@ -16,7 +16,7 @@
# #
%define real_version 6.8.1 %define real_version 6.8.2
%define short_version 6.8 %define short_version 6.8
%define tar_name qtwayland-everywhere-src %define tar_name qtwayland-everywhere-src
%define tar_suffix %{nil} %define tar_suffix %{nil}
@ -30,7 +30,7 @@
%global with_opengl 1 %global with_opengl 1
%endif %endif
Name: qt6-wayland%{?pkg_suffix} Name: qt6-wayland%{?pkg_suffix}
Version: 6.8.1 Version: 6.8.2
Release: 0 Release: 0
Summary: Qt 6 Wayland libraries and tools Summary: Qt 6 Wayland libraries and tools
# The wayland compositor files are GPL-3.0-or-later # The wayland compositor files are GPL-3.0-or-later
@ -40,12 +40,6 @@ Source0: https://download.qt.io/official_releases/qt/%{short_version}/%{r
Source99: qt6-wayland-rpmlintrc Source99: qt6-wayland-rpmlintrc
# PATCH-FIX-UPSTREAM # PATCH-FIX-UPSTREAM
Patch0: 0001-update-wayland_xml-to-version-1_23_0.patch Patch0: 0001-update-wayland_xml-to-version-1_23_0.patch
# PATCH-FIX-UPSTREAM
# fix crash when attach differ shellsurface to the same shellsurfaceitem
# https://codereview.qt-project.org/c/qt/qtwayland/+/599732
Patch1: 0001-fix-crash-issue.patch
# PATCH-FIX-UPSTREAM -- Fix crash when unplugging a graphics tablet
Patch2: 0001-client-Redo-management-of-tablet-object-proxies.patch
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: qt6-core-private-devel BuildRequires: qt6-core-private-devel
BuildRequires: qt6-gui-private-devel BuildRequires: qt6-gui-private-devel

BIN
qtwayland-everywhere-src-6.8.1.tar.xz (Stored with Git LFS)

Binary file not shown.

BIN
qtwayland-everywhere-src-6.8.2.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.