[Qgis-developer] QgsRubberBand RuntimeError: underlying C/C++ object has been deleted

Radim Blazek radim.blazek at gmail.com
Wed Feb 12 04:45:56 PST 2014


I am using rubber band in Python plugin:
  self.rb = QgsRubberBand(self.canvas,  QGis.Polygon)
and on mouse move
  self.rb.addPoint( point, update )

It works well on most systems only for Win7/32bit (QGIS 2.0.1, Python
2.7.4) it was reported that it fails with "RuntimeError: underlying
C/C++ object has been deleted"

I see that ownership of rubber band is passed to map canvas

   QgsRubberBand( QgsMapCanvas* mapCanvas /TransferThis/,
QGis::GeometryType geometryType = QGis::Line );

that is OK, but QgsMapCanvas should not delete QGraphicsItem until it
is destructed.

So how can the QgsRubberBand be deleted before QGIS is closed?

Radim


More information about the Qgis-developer mailing list