diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-05-09 12:56:25 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-05-09 20:01:41 +0000 |
commit | 80812d1b8a63cb8aef9b4f0928c226f5c7f386c5 (patch) | |
tree | 12d8656ac0057aec6c9265a8b9d5866f1703a842 /src/location/labs | |
parent | cad3ffc8c90f3c194d06e52c981cd54cdab509ec (diff) | |
download | qtlocation-80812d1b8a63cb8aef9b4f0928c226f5c7f386c5.tar.gz |
Fix crash in Map{Polyline,Polygon,Route}ObjectQsg
When these objects get added to a map but aren't immediately visible
(meaning are outside the visible region entirely), their respective
QSGNodes will be marked as blocked.
However, this isn't handled gracefully in qsgbatchrenderer.
Renderer::nodeWasAdded discards nodes that are blocked.
Meaning that when they will become unblocked, the node will
result in being unallocated.
This patch makes sure that a node is not instantiated at all
if it would result in a blocked node.
Change-Id: I8e174ba1d317e1d0c4006d993ec558bdad8a5b39
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/location/labs')
-rw-r--r-- | src/location/labs/qsg/qmappolygonobjectqsg.cpp | 2 | ||||
-rw-r--r-- | src/location/labs/qsg/qmappolylineobjectqsg.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/location/labs/qsg/qmappolygonobjectqsg.cpp b/src/location/labs/qsg/qmappolygonobjectqsg.cpp index b9602a3a..239df177 100644 --- a/src/location/labs/qsg/qmappolygonobjectqsg.cpp +++ b/src/location/labs/qsg/qmappolygonobjectqsg.cpp @@ -85,6 +85,8 @@ QSGNode *QMapPolygonObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, bool created = false; if (!node) { + if (!m_geometry.size() && !m_borderGeometry.size()) + return nullptr; node = new MapPolygonNode(); *visibleNode = static_cast<VisibleNode *>(node); created = true; diff --git a/src/location/labs/qsg/qmappolylineobjectqsg.cpp b/src/location/labs/qsg/qmappolylineobjectqsg.cpp index 6b782c77..f4a1a288 100644 --- a/src/location/labs/qsg/qmappolylineobjectqsg.cpp +++ b/src/location/labs/qsg/qmappolylineobjectqsg.cpp @@ -107,6 +107,8 @@ QSGNode *QMapPolylineObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, bool created = false; if (!node) { + if (!m_geometry.size()) // condition to block the subtree + return nullptr; node = new MapPolylineNode(); *visibleNode = static_cast<VisibleNode *>(node); created = true; |