From 5af85585d3b7e1bdc9d62bc71b800f512956a37b86912a43628b77f412b695db Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Tue, 1 Dec 2020 12:00:04 +0000 Subject: [PATCH] Accepting request 852326 from home:cgiboudeaux:branches:KDE:Qt:5.15 - Add upstream patch to fix a regression: * 0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch OBS-URL: https://build.opensuse.org/request/show/852326 OBS-URL: https://build.opensuse.org/package/show/KDE:Qt:5.15/libqt5-qtwayland?expand=0&rev=12 --- ...cessing-dangling-pointers-in-destroy.patch | 37 +++++++++++++++++++ libqt5-qtwayland.changes | 6 +++ libqt5-qtwayland.spec | 2 + 3 files changed, 45 insertions(+) create mode 100644 0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch diff --git a/0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch b/0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch new file mode 100644 index 0000000..5754a8a --- /dev/null +++ b/0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch @@ -0,0 +1,37 @@ +From e5c272423d1bba2825086b82fd97499237a6fa4b Mon Sep 17 00:00:00 2001 +From: Vlad Zahorodnii +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. + +Change-Id: I26408228f58919db17eb29584a1cbd4a9427d25c +Reviewed-by: Eskil Abrahamsen Blomfeldt +(cherry picked from commit 735164b5c2a2637a8d53a8803a2401e4ef477ff0) +Reviewed-by: Qt Cherry-pick Bot +--- + 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 1d635f06..e2f87bbd 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.29.2 + diff --git a/libqt5-qtwayland.changes b/libqt5-qtwayland.changes index 1fef6d8..0be9dc7 100644 --- a/libqt5-qtwayland.changes +++ b/libqt5-qtwayland.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Dec 1 11:36:23 UTC 2020 - Christophe Giboudeaux + +- Add upstream patch to fix a regression: + * 0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch + ------------------------------------------------------------------- Fri Nov 20 12:09:45 UTC 2020 - Fabian Vogt diff --git a/libqt5-qtwayland.spec b/libqt5-qtwayland.spec index ad47a8b..82d6d0e 100644 --- a/libqt5-qtwayland.spec +++ b/libqt5-qtwayland.spec @@ -32,6 +32,8 @@ Group: Development/Libraries/X11 URL: https://www.qt.io Source: https://download.qt.io/official_releases/qt/5.15/%{real_version}/submodules/%{tar_version}.tar.xz Source1: baselibs.conf +# PATCH-FIX-UPSTREAM +Patch0: 0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch BuildRequires: fdupes BuildRequires: libqt5-qtbase-private-headers-devel >= %{version} BuildRequires: libqt5-qtdeclarative-private-headers-devel >= %{version}