Commit 9daf00ef authored by Paolo Angelelli's avatar Paolo Angelelli
Browse files

Assign QGeoMapObjectPrivate::m_map after creating the new implementation


Or else it will be null, as no copy constructor for QGeoMapPrivate is
defined (and used).

Change-Id: I6045ccd4ec15c775a6ae0f9c55107103dfe28e9e
Reviewed-by: default avatarBogDan Vatra <bogdan@kdab.com>
Showing with 13 additions and 1 deletion
...@@ -176,16 +176,28 @@ void QGeoMapObject::setMap(QGeoMap *map) ...@@ -176,16 +176,28 @@ void QGeoMapObject::setMap(QGeoMap *map)
if (d_ptr->m_map == map) if (d_ptr->m_map == map)
return; return;
d_ptr->m_map = map;
if (map) { if (map) {
bool oldVisible = d_ptr->m_visible;
bool oldCmponentCompleted = d_ptr->m_componentCompleted;
if (!map->createMapObjectImplementation(this)) if (!map->createMapObjectImplementation(this))
qWarning() << "Unsupported type " << type(); qWarning() << "Unsupported type " << type();
// old implementation gets destroyed if/when d_ptr gets replaced // old implementation gets destroyed if/when d_ptr gets replaced
d_ptr->m_componentCompleted = oldCmponentCompleted;
d_ptr->setVisible(oldVisible);
} }
d_ptr->m_map = map;
const QList<QGeoMapObject *> kids = geoMapObjectChildren(); const QList<QGeoMapObject *> kids = geoMapObjectChildren();
for (auto kid : kids) for (auto kid : kids)
kid->setMap(map); kid->setMap(map);
// Each subclass is in charge to do the equivalent of
// if (!map) {
// // Map was set, now it has ben re-set to NULL
// d_ptr = new QMapCircleObjectPrivateDefault(*d);
// // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
// }
// After this method is called.
} }
QGeoMap *QGeoMapObject::map() const QGeoMap *QGeoMapObject::map() const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment