[Qgis-developer] QGIS crash when displaying lines using QgsGeometryRubberBand
Casper Børgesen (CABO)
CABO at NIRAS.DK
Wed Nov 2 12:37:15 PDT 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161102/2e5dff37/attachment.html>
More information about the Qgis-developer
mailing list