commit: df09d077cf4b5361c6d9e8c7da213cb46206e4a5 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Thu Jan 7 15:23:57 2021 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Thu Jan 7 16:30:32 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df09d077
dev-qt/qtwayland: Scanner: Avoid dangling pointers in destroy_func() See also: https://mail.kde.org/pipermail/plasma-devel/2021-January/119115.html Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> ...-qtwaylandscanner-avoid-dangling-pointers.patch | 35 ++++++++++++++++++ dev-qt/qtwayland/qtwayland-5.15.2-r1.ebuild | 41 ++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/dev-qt/qtwayland/files/qtwayland-5.15.2-qtwaylandscanner-avoid-dangling-pointers.patch b/dev-qt/qtwayland/files/qtwayland-5.15.2-qtwaylandscanner-avoid-dangling-pointers.patch new file mode 100644 index 00000000000..0799cb1a202 --- /dev/null +++ b/dev-qt/qtwayland/files/qtwayland-5.15.2-qtwaylandscanner-avoid-dangling-pointers.patch @@ -0,0 +1,35 @@ +From 735164b5c2a2637a8d53a8803a2401e4ef477ff0 Mon Sep 17 00:00:00 2001 +From: Vlad Zahorodnii <[email protected]> +Date: Fri, 30 Oct 2020 16:55:30 +0200 +Subject: [PATCH] Scanner: Avoid accessing dangling pointers in destroy_func() + +Usually, the object associated with the resource gets destroyed in the +destroy_resource() function. + +Therefore, we need to double-check that the object is still alive before +trying to reset its m_resource. + +Pick-to: 5.15 +Change-Id: I26408228f58919db17eb29584a1cbd4a9427d25c +Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]> +--- + src/qtwaylandscanner/qtwaylandscanner.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp +index 1a1f8bf16..450ef519d 100644 +--- a/src/qtwaylandscanner/qtwaylandscanner.cpp ++++ b/src/qtwaylandscanner/qtwaylandscanner.cpp +@@ -814,7 +814,9 @@ bool Scanner::process() + printf(" if (Q_LIKELY(that)) {\n"); + printf(" that->m_resource_map.remove(resource->client(), resource);\n"); + printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped); +- printf(" if (that->m_resource == resource)\n"); ++ printf("\n"); ++ printf(" that = resource->%s_object;\n", interfaceNameStripped); ++ printf(" if (that && that->m_resource == resource)\n"); + printf(" that->m_resource = nullptr;\n"); + printf(" }\n"); + printf(" delete resource;\n"); +-- +2.16.3 diff --git a/dev-qt/qtwayland/qtwayland-5.15.2-r1.ebuild b/dev-qt/qtwayland/qtwayland-5.15.2-r1.ebuild new file mode 100644 index 00000000000..ea32d4ffc9c --- /dev/null +++ b/dev-qt/qtwayland/qtwayland-5.15.2-r1.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit qt5-build + +DESCRIPTION="Wayland platform plugin for Qt" + +if [[ ${QT5_BUILD_TYPE} == release ]]; then + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86" +fi + +IUSE="vulkan X" + +DEPEND=" + >=dev-libs/wayland-1.6.0 + ~dev-qt/qtcore-${PV} + ~dev-qt/qtdeclarative-${PV} + ~dev-qt/qtgui-${PV}[egl,libinput,vulkan=] + media-libs/mesa[egl] + >=x11-libs/libxkbcommon-0.2.0 + vulkan? ( dev-util/vulkan-headers ) + X? ( + ~dev-qt/qtgui-${PV}[-gles2-only] + x11-libs/libX11 + x11-libs/libXcomposite + ) +" +RDEPEND="${DEPEND}" + +PATCHES=( "${FILESDIR}"/${P}-qtwaylandscanner-avoid-dangling-pointers.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 +}
