Hi!

I was trying to visualize a linestring using the QgsGeometryRubberBand and had 
QGIS crashing as soon as the rubber band was being drawn. It looks like the 
geometry is being corrupted somewhere.

If I draw a polygon it works fine:

from qgis.core import *
from qgis.gui import *
rb = QgsGeometryRubberBand(iface.mapCanvas(), QGis.Polygon)
g = QgsGeometry.fromWkt('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))')
rb.setGeometry(g.geometry().clone())

If I draw a line instead QGIS crashes:

from qgis.core import *
from qgis.gui import *
rb = QgsGeometryRubberBand(iface.mapCanvas(), QGis.Line)
g = QgsGeometry.fromWkt('LINESTRING(0 0, 1 1)')
rb.setGeometry(g.geometry().clone())

The crash happens at: 
https://github.com/qgis/QGIS/blob/release-2_18/src/gui/qgsgeometryrubberband.cpp#L57

QgsAbstractGeometryV2* paintGeom = mGeometry->clone();

Is it a difference in the deep copy/clone mechanism that fails somehow, since I 
guess that the problem arises in the cloning of the abstract geometry in my two 
samples and not in line 57 of qgsgeometryrubberband.cpp?


Regards, Casper
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to