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

Denis Rouzaud denis.rouzaud at gmail.com
Thu Feb 13 00:49:06 PST 2014


On 13. 02. 14 09:45, Radim Blazek wrote:
> On Thu, Feb 13, 2014 at 9:04 AM, Denis Rouzaud <denis.rouzaud at gmail.com> wrote:
>> Hi Radim,
>>
>> It seems it is your point that has been deleted, not the rubber band.
>> Doing "print point" before addPoint crashes.
> Good, thanks and sorry for false pointing to rubber band.
>
> However, do you have any idea where the point may be deleted? The
> points are acquired from QgsGeometry.asPolyline() which returns
> QVector<QgsPoint>, i.e. list of values. The points are then add to
> another list: result.extend( pnts[1:-1] ). Is it wrong? The points get
> deleted with original list?
I suppose you need to do a copy of your point in the result of the snapping.

do: point = QgsPoint( result[0].snappedVertex )

otherwise, result get out of scope at the end of the method and your 
point is deleted.

Cheers,

Denis


More information about the Qgis-developer mailing list