summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-02-08 12:02:18 +0100
committerBogDan Vatra <bogdan@kdab.com>2018-02-08 13:46:42 +0000
commite077ad0f5fb4a9513d9cd778e5cbb6b6d38ae026 (patch)
tree4b7fae48a18c98822d524befa3b32abec1e8e3bb
parent912e7eaf9a044941f7f351d8fe2dfdec71760f73 (diff)
downloadqtlocation-e077ad0f5fb4a9513d9cd778e5cbb6b6d38ae026.tar.gz
Preemptively release pendingMapObjects upon Map destruction
In this way QGeoMap::mapObjects doesn't have to return all map objects, as the user added ones should be covered by m_pendingMapObjects. Change-Id: I5c850f2fb820629e0c4dd941d13f04cb3684b898 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 9f53c4d8..1bf5ea87 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -269,6 +269,9 @@ QDeclarativeGeoMap::~QDeclarativeGeoMap()
delete m_copyrights.data();
m_copyrights.clear();
+ for (auto obj: qAsConst(m_pendingMapObjects))
+ obj->setMap(nullptr); // worst case: going to be setMap(nullptr)'d twice
+
delete m_map; // map objects get reset here
}