commit:     efca1f2c0288304eb5cc06500d01d9847da48dc7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 14 07:29:04 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 14 07:29:41 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efca1f2c

dev-qt/qtwayland: backport use-after-free fix to 5.15.10-r1

Closes: https://bugs.gentoo.org/910315
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ....15.10-Destroy-frame-queue-before-display.patch | 34 +++++++++++++
 dev-qt/qtwayland/qtwayland-5.15.10-r1.ebuild       | 57 ++++++++++++++++++++++
 2 files changed, 91 insertions(+)

diff --git 
a/dev-qt/qtwayland/files/qtwayland-5.15.10-Destroy-frame-queue-before-display.patch
 
b/dev-qt/qtwayland/files/qtwayland-5.15.10-Destroy-frame-queue-before-display.patch
new file mode 100644
index 000000000000..9844d25dbebf
--- /dev/null
+++ 
b/dev-qt/qtwayland/files/qtwayland-5.15.10-Destroy-frame-queue-before-display.patch
@@ -0,0 +1,34 @@
+https://bugs.gentoo.org/910315
+https://invent.kde.org/qt/qt/qtwayland/-/merge_requests/73
+
+From 3a8613b91d2239aebc73b43562f929aa71af0de5 Mon Sep 17 00:00:00 2001
+From: David Redondo <[email protected]>
+Date: Tue, 11 Apr 2023 14:27:27 +0200
+Subject: [PATCH] Destroy frame queue before display
+
+wl_event_queue_destroy accesses the display.
+Found by running a test under valgrind.
+
+Pick-to: 6.5
+Change-Id: Ic89cbd3b6e98b4fc9561b0e63b5fab4886a1ec50
+Reviewed-by: David Edmundson <[email protected]>
+(cherry picked from commit a76bf824fcd1cc3789f0d3454a0423c0241d9718)
+--- a/src/client/qwaylanddisplay.cpp
++++ b/src/client/qwaylanddisplay.cpp
+@@ -379,11 +379,12 @@ QWaylandDisplay::~QWaylandDisplay(void)
+ #if QT_CONFIG(cursor)
+     qDeleteAll(mCursorThemes);
+ #endif
+-    if (mDisplay)
+-        wl_display_disconnect(mDisplay);
+ 
+     if (m_frameEventQueue)
+         wl_event_queue_destroy(m_frameEventQueue);
++
++    if (mDisplay)
++        wl_display_disconnect(mDisplay);
+ }
+ 
+ // Steps which is called just after constructor. This separates 
registry_global() out of the constructor
+-- 
+2.41.0

diff --git a/dev-qt/qtwayland/qtwayland-5.15.10-r1.ebuild 
b/dev-qt/qtwayland/qtwayland-5.15.10-r1.ebuild
new file mode 100644
index 000000000000..7240ae37c5e2
--- /dev/null
+++ b/dev-qt/qtwayland/qtwayland-5.15.10-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+if [[ ${PV} != *9999* ]]; then
+       QT5_KDEPATCHSET_REV=1
+       KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc 
~x86"
+fi
+
+inherit qt5-build
+
+DESCRIPTION="Wayland platform plugin for Qt"
+
+SLOT=5/${QT5_PV} # bug 815646
+IUSE="vulkan X"
+
+DEPEND="
+       dev-libs/wayland
+       =dev-qt/qtcore-${QT5_PV}*:5=
+       =dev-qt/qtdeclarative-${QT5_PV}*:5=
+       =dev-qt/qtgui-${QT5_PV}*:5=[egl,libinput,vulkan=,X?]
+       media-libs/libglvnd
+       vulkan? ( dev-util/vulkan-headers )
+       X? (
+               =dev-qt/qtgui-${QT5_PV}*[-gles2-only]
+               x11-libs/libX11
+               x11-libs/libXcomposite
+       )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="dev-util/wayland-scanner"
+
+PATCHES=(
+       # QTBUG-97037, pending upstream:
+       # https://invent.kde.org/qt/qt/qtwayland/-/merge_requests/71
+       
"${FILESDIR}/${PN}-5.15.9-fix-mouse-stuck-in-pressed-state-after-DnD.patch"
+       "${FILESDIR}/${P}-send-release-button-event-on-pointer-leave.patch"
+       # bug #910315, pending upstream:
+       # https://invent.kde.org/qt/qt/qtwayland/-/merge_requests/73
+       "${FILESDIR}/${P}-Destroy-frame-queue-before-display.patch"
+)
+
+src_configure() {
+       local myqmakeargs=(
+               --
+               $(qt_use vulkan feature-wayland-vulkan-server-buffer)
+               $(qt_use X feature-xcomposite-egl)
+               $(qt_use X feature-xcomposite-glx)
+       )
+       qt5-build_src_configure
+}
+
+src_install() {
+       qt5-build_src_install
+       rm "${D}${QT5_BINDIR}"/qtwaylandscanner || die
+}

Reply via email to