1 |
commit: 6c15f422ef1ae2def29a3b9fc1ad9f3c7b77bad3 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jan 1 16:46:32 2021 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 2 01:22:32 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c15f422 |
7 |
|
8 |
dev-qt/qtlocation: Fix QSG Render Thread crash |
9 |
|
10 |
See also: https://bugreports.qt.io/browse/QTBUG-85260 |
11 |
|
12 |
Package-Manager: Portage-3.0.12, Repoman-3.0.2 |
13 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
14 |
|
15 |
...location-5.15.2-qsg-render-thread-crash-1.patch | 66 ++++++++++++ |
16 |
...location-5.15.2-qsg-render-thread-crash-2.patch | 115 +++++++++++++++++++++ |
17 |
dev-qt/qtlocation/qtlocation-5.15.2-r1.ebuild | 50 +++++++++ |
18 |
3 files changed, 231 insertions(+) |
19 |
|
20 |
diff --git a/dev-qt/qtlocation/files/qtlocation-5.15.2-qsg-render-thread-crash-1.patch b/dev-qt/qtlocation/files/qtlocation-5.15.2-qsg-render-thread-crash-1.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..d4cd0188d1a |
23 |
--- /dev/null |
24 |
+++ b/dev-qt/qtlocation/files/qtlocation-5.15.2-qsg-render-thread-crash-1.patch |
25 |
@@ -0,0 +1,66 @@ |
26 |
+From 4fe9e0ed027134a833b2243597a2ccd00987b559 Mon Sep 17 00:00:00 2001 |
27 |
+From: Piotr Mikolajczyk <piotr.mikolajczyk@××.io> |
28 |
+Date: Tue, 29 Sep 2020 10:41:23 +0200 |
29 |
+Subject: [PATCH] Fix crash when showing Map QML comp. for 2nd+ time |
30 |
+ |
31 |
+Crash caused by storing pointer to a node that could be deleted elsewhere |
32 |
+ |
33 |
+Fixes: QTBUG-85260 |
34 |
+Change-Id: I871123322fac84b8bf91e9bab8ecad08e75c2854 |
35 |
+Reviewed-by: Paolo Angelelli <paolo.angelelli.qt@×××××.com> |
36 |
+--- |
37 |
+ src/location/labs/qsg/qgeomapobjectqsgsupport.cpp | 29 ++++++++++++++++++++++- |
38 |
+ 1 file changed, 28 insertions(+), 1 deletion(-) |
39 |
+ |
40 |
+diff --git a/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp b/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp |
41 |
+index 0e1df8f6c..cd1801305 100644 |
42 |
+--- a/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp |
43 |
++++ b/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp |
44 |
+@@ -48,7 +48,32 @@ static int findMapObject(QGeoMapObject *o, const QList<MapObject> &list) |
45 |
+ } |
46 |
+ return -1; |
47 |
+ } |
48 |
++namespace { |
49 |
++bool findNodeInStructure(QSGNode *root, QSGNode *item) |
50 |
++{ |
51 |
++ if (root == nullptr || item == nullptr) |
52 |
++ return false; |
53 |
++ if (root == item) |
54 |
++ return true; |
55 |
++ auto currentChild = root->firstChild(); |
56 |
++ // First check the direct child nodes and if not found let's dive deeper |
57 |
++ bool bFound = (item == currentChild); |
58 |
++ |
59 |
++ while (!bFound && currentChild) { |
60 |
++ currentChild = currentChild->nextSibling(); |
61 |
++ bFound = (item == currentChild); |
62 |
++ } |
63 |
+ |
64 |
++ if (!bFound) { |
65 |
++ currentChild = root->firstChild(); |
66 |
++ while (!bFound && currentChild) { |
67 |
++ bFound = findNodeInStructure(currentChild, item); |
68 |
++ currentChild = currentChild->nextSibling(); |
69 |
++ } |
70 |
++ } |
71 |
++ return bFound; |
72 |
++} |
73 |
++} |
74 |
+ bool QGeoMapObjectQSGSupport::createMapObjectImplementation(QGeoMapObject *obj, QGeoMapPrivate *d) |
75 |
+ { |
76 |
+ QExplicitlySharedDataPointer<QGeoMapObjectPrivate> pimpl = |
77 |
+@@ -157,9 +182,11 @@ void QGeoMapObjectQSGSupport::updateMapObjects(QSGNode *root, QQuickWindow *wind |
78 |
+ { |
79 |
+ if (!root) |
80 |
+ return; |
81 |
++ if (!findNodeInStructure(root, m_mapObjectsRootNode)) |
82 |
++ m_mapObjectsRootNode = nullptr; |
83 |
+ if (!m_mapObjectsRootNode) { |
84 |
+ m_mapObjectsRootNode = new QDeclarativePolygonMapItemPrivateOpenGL::RootNode(); |
85 |
+- root->appendChildNode(m_mapObjectsRootNode); |
86 |
++ root->appendChildNode(m_mapObjectsRootNode); // PASSING OWNERSHIP! |
87 |
+ } |
88 |
+ |
89 |
+ m_mapObjectsRootNode->removeAllChildNodes(); |
90 |
+-- |
91 |
+2.16.3 |
92 |
|
93 |
diff --git a/dev-qt/qtlocation/files/qtlocation-5.15.2-qsg-render-thread-crash-2.patch b/dev-qt/qtlocation/files/qtlocation-5.15.2-qsg-render-thread-crash-2.patch |
94 |
new file mode 100644 |
95 |
index 00000000000..4bd70b99abb |
96 |
--- /dev/null |
97 |
+++ b/dev-qt/qtlocation/files/qtlocation-5.15.2-qsg-render-thread-crash-2.patch |
98 |
@@ -0,0 +1,115 @@ |
99 |
+From 861e372b6ad81570d4f496e42fb25a6699b72f2f Mon Sep 17 00:00:00 2001 |
100 |
+From: Piotr Mikolajczyk <piotr.mikolajczyk@××.io> |
101 |
+Date: Tue, 3 Nov 2020 11:43:22 +0100 |
102 |
+Subject: [PATCH] Simpler fix to crashing Qml Map appearing 2nd+ time |
103 |
+ |
104 |
+Previous solution did not take advantage of the QSGNode::OwnedByParent |
105 |
+flag. Setting this flag to false allows to use parent() property |
106 |
+to determine if the node has been removed from node tree. |
107 |
+This amends 4fe9e0ed027134a833b2243597a2ccd00987b559 |
108 |
+ |
109 |
+Fixes: QTBUG-85260 |
110 |
+Change-Id: I705848483d7dc2639dffffa0ff66c682b3fffca0 |
111 |
+Reviewed-by: Andy Shaw <andy.shaw@××.io> |
112 |
+--- |
113 |
+ src/location/labs/qsg/qgeomapobjectqsgsupport.cpp | 40 +++++------------------ |
114 |
+ src/location/labs/qsg/qgeomapobjectqsgsupport_p.h | 3 +- |
115 |
+ 2 files changed, 11 insertions(+), 32 deletions(-) |
116 |
+ |
117 |
+diff --git a/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp b/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp |
118 |
+index cd1801305..a978573d6 100644 |
119 |
+--- a/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp |
120 |
++++ b/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp |
121 |
+@@ -48,32 +48,7 @@ static int findMapObject(QGeoMapObject *o, const QList<MapObject> &list) |
122 |
+ } |
123 |
+ return -1; |
124 |
+ } |
125 |
+-namespace { |
126 |
+-bool findNodeInStructure(QSGNode *root, QSGNode *item) |
127 |
+-{ |
128 |
+- if (root == nullptr || item == nullptr) |
129 |
+- return false; |
130 |
+- if (root == item) |
131 |
+- return true; |
132 |
+- auto currentChild = root->firstChild(); |
133 |
+- // First check the direct child nodes and if not found let's dive deeper |
134 |
+- bool bFound = (item == currentChild); |
135 |
+- |
136 |
+- while (!bFound && currentChild) { |
137 |
+- currentChild = currentChild->nextSibling(); |
138 |
+- bFound = (item == currentChild); |
139 |
+- } |
140 |
+ |
141 |
+- if (!bFound) { |
142 |
+- currentChild = root->firstChild(); |
143 |
+- while (!bFound && currentChild) { |
144 |
+- bFound = findNodeInStructure(currentChild, item); |
145 |
+- currentChild = currentChild->nextSibling(); |
146 |
+- } |
147 |
+- } |
148 |
+- return bFound; |
149 |
+-} |
150 |
+-} |
151 |
+ bool QGeoMapObjectQSGSupport::createMapObjectImplementation(QGeoMapObject *obj, QGeoMapPrivate *d) |
152 |
+ { |
153 |
+ QExplicitlySharedDataPointer<QGeoMapObjectPrivate> pimpl = |
154 |
+@@ -182,11 +157,14 @@ void QGeoMapObjectQSGSupport::updateMapObjects(QSGNode *root, QQuickWindow *wind |
155 |
+ { |
156 |
+ if (!root) |
157 |
+ return; |
158 |
+- if (!findNodeInStructure(root, m_mapObjectsRootNode)) |
159 |
+- m_mapObjectsRootNode = nullptr; |
160 |
++ |
161 |
++ if (m_mapObjectsRootNode && m_mapObjectsRootNode->parent()) |
162 |
++ root->appendChildNode(m_mapObjectsRootNode.get()); |
163 |
++ |
164 |
+ if (!m_mapObjectsRootNode) { |
165 |
+- m_mapObjectsRootNode = new QDeclarativePolygonMapItemPrivateOpenGL::RootNode(); |
166 |
+- root->appendChildNode(m_mapObjectsRootNode); // PASSING OWNERSHIP! |
167 |
++ m_mapObjectsRootNode = std::make_unique<QDeclarativePolygonMapItemPrivateOpenGL::RootNode>(); |
168 |
++ root->appendChildNode(m_mapObjectsRootNode.get()); |
169 |
++ m_mapObjectsRootNode->setFlag(QSGNode::OwnedByParent, false); |
170 |
+ } |
171 |
+ |
172 |
+ m_mapObjectsRootNode->removeAllChildNodes(); |
173 |
+@@ -211,7 +189,7 @@ void QGeoMapObjectQSGSupport::updateMapObjects(QSGNode *root, QQuickWindow *wind |
174 |
+ MapObject &mo = m_mapObjects[i]; |
175 |
+ QQSGMapObject *sgo = mo.sgObject; |
176 |
+ QSGNode *oldNode = mo.qsgNode; |
177 |
+- mo.qsgNode = sgo->updateMapObjectNode(oldNode, &mo.visibleNode, m_mapObjectsRootNode, window); |
178 |
++ mo.qsgNode = sgo->updateMapObjectNode(oldNode, &mo.visibleNode, m_mapObjectsRootNode.get(), window); |
179 |
+ if (Q_UNLIKELY(!mo.qsgNode)) { |
180 |
+ qWarning() << "updateMapObjectNode for "<<mo.object->type() << " returned NULL"; |
181 |
+ } else if (mo.visibleNode && (mo.visibleNode->visible() != mo.object->visible())) { |
182 |
+@@ -227,7 +205,7 @@ void QGeoMapObjectQSGSupport::updateMapObjects(QSGNode *root, QQuickWindow *wind |
183 |
+ QQSGMapObject *sgo = mo.sgObject; |
184 |
+ QSGNode *oldNode = mo.qsgNode; |
185 |
+ sgo->updateGeometry(); // or subtree will be blocked |
186 |
+- mo.qsgNode = sgo->updateMapObjectNode(oldNode, &mo.visibleNode, m_mapObjectsRootNode, window); |
187 |
++ mo.qsgNode = sgo->updateMapObjectNode(oldNode, &mo.visibleNode, m_mapObjectsRootNode.get(), window); |
188 |
+ if (mo.qsgNode) { |
189 |
+ if (mo.visibleNode && (mo.visibleNode->visible() != mo.object->visible())) { |
190 |
+ mo.visibleNode->setVisible(mo.object->visible()); |
191 |
+diff --git a/src/location/labs/qsg/qgeomapobjectqsgsupport_p.h b/src/location/labs/qsg/qgeomapobjectqsgsupport_p.h |
192 |
+index 1ec966fa9..cbbc09691 100644 |
193 |
+--- a/src/location/labs/qsg/qgeomapobjectqsgsupport_p.h |
194 |
++++ b/src/location/labs/qsg/qgeomapobjectqsgsupport_p.h |
195 |
+@@ -59,6 +59,7 @@ |
196 |
+ #include <QtLocation/private/qdeclarativepolylinemapitem_p.h> |
197 |
+ #include <QtLocation/private/qdeclarativepolygonmapitem_p_p.h> |
198 |
+ #include <QtCore/qpointer.h> |
199 |
++#include <memory> |
200 |
+ |
201 |
+ QT_BEGIN_NAMESPACE |
202 |
+ struct Q_LOCATION_PRIVATE_EXPORT MapObject { |
203 |
+@@ -85,7 +86,7 @@ public: |
204 |
+ QList<MapObject> m_pendingMapObjects; |
205 |
+ QList<MapObject> m_removedMapObjects; |
206 |
+ QGeoMap *m_map = nullptr; |
207 |
+- QDeclarativePolygonMapItemPrivateOpenGL::RootNode *m_mapObjectsRootNode = nullptr; |
208 |
++ std::unique_ptr<QDeclarativePolygonMapItemPrivateOpenGL::RootNode> m_mapObjectsRootNode; |
209 |
+ }; |
210 |
+ |
211 |
+ QT_END_NAMESPACE |
212 |
+-- |
213 |
+2.16.3 |
214 |
|
215 |
diff --git a/dev-qt/qtlocation/qtlocation-5.15.2-r1.ebuild b/dev-qt/qtlocation/qtlocation-5.15.2-r1.ebuild |
216 |
new file mode 100644 |
217 |
index 00000000000..7799c0163e0 |
218 |
--- /dev/null |
219 |
+++ b/dev-qt/qtlocation/qtlocation-5.15.2-r1.ebuild |
220 |
@@ -0,0 +1,50 @@ |
221 |
+# Copyright 1999-2021 Gentoo Authors |
222 |
+# Distributed under the terms of the GNU General Public License v2 |
223 |
+ |
224 |
+EAPI=7 |
225 |
+ |
226 |
+inherit qt5-build |
227 |
+ |
228 |
+DESCRIPTION="Location (places, maps, navigation) library for the Qt5 framework" |
229 |
+ |
230 |
+if [[ ${QT5_BUILD_TYPE} == release ]]; then |
231 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86" |
232 |
+fi |
233 |
+ |
234 |
+IUSE="" |
235 |
+ |
236 |
+RDEPEND=" |
237 |
+ dev-libs/icu:= |
238 |
+ ~dev-qt/qtcore-${PV} |
239 |
+ ~dev-qt/qtdeclarative-${PV} |
240 |
+ ~dev-qt/qtgui-${PV} |
241 |
+ ~dev-qt/qtnetwork-${PV} |
242 |
+ ~dev-qt/qtpositioning-${PV}[qml] |
243 |
+ ~dev-qt/qtsql-${PV} |
244 |
+ sys-libs/zlib |
245 |
+" |
246 |
+DEPEND="${RDEPEND} |
247 |
+ ~dev-qt/qtconcurrent-${PV} |
248 |
+" |
249 |
+ |
250 |
+QT5_TARGET_SUBDIRS=( |
251 |
+ src/3rdparty/clipper |
252 |
+ src/3rdparty/poly2tri |
253 |
+ src/3rdparty/clip2tri |
254 |
+ src/3rdparty/mapbox-gl-native |
255 |
+ src/location |
256 |
+ src/imports/location |
257 |
+ src/imports/locationlabs |
258 |
+ src/plugins/geoservices |
259 |
+) |
260 |
+ |
261 |
+PATCHES=( "${FILESDIR}"/${P}-qsg-render-thread-crash-{1,2}.patch ) # QTBUG-85260 |
262 |
+ |
263 |
+src_configure() { |
264 |
+ # src/plugins/geoservices requires files that are only generated when |
265 |
+ # qmake is run in the root directory. Bug 633776. |
266 |
+ mkdir -p "${QT5_BUILD_DIR}"/src/location || die |
267 |
+ qt5_qmake "${QT5_BUILD_DIR}" |
268 |
+ cp "${S}"/src/location/qtlocation-config.pri "${QT5_BUILD_DIR}"/src/location || die |
269 |
+ qt5-build_src_configure |
270 |
+} |