Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
1.2.0
-
None
-
Win7 64, MinGW, QtDesktop 4.7.4
Description
There is a seg fault when transferring a QGeoCustomMapObject subclass from one GeoMap to another one, using removeMapObject and addMapObject.
For other map objects (QGeoMapPolylineObject, QGeoMapCircleObject, ...), the associated QGraphicsItem are contained in the QGeoTiledMapObjectInfo class and are created when the object is added to a GeoMap, and also deleted when removed from a GeoMap, when the info object is destroyed.
However, for Custom map objects, the QGeoTiledMapCustomObjectInfo class does NOT create QGraphicsItem, it only copies the pointer from the QGeoMapCustomObject class.
Thus, the problem is that the first time a custom object is removed from a GeoMap, its QGraphicsItem gets deleted (in the destructor of QGeoTiledMapObjectInfo), and it crashes if we use the QGeoCustomMapObject again.
The solution I guess is to un-comment the QGeoTiledMapCustomObjectInfo destructor which sets the graphicsItem to NULL, preventing the QGeoTiledMapObjectInfo destructor from deleting it: //custom->setGraphicsItem(0);
Why is this line commented out ?
The graphicsItem could be deleted when the QGeoCustomMapObject is deleted ?