[Qgis-developer] crash when accessing geometry from Python console

Bernhard Ströbl bernhard.stroebl at jena.de
Thu Jun 25 00:03:08 PDT 2015


Hm,

the following code returns the geometry ok:
for feat in iface.activeLayer().selectedFeatures():
   g=feat.geometry()
   break

Bernhard

Am 25.06.2015 um 08:43 schrieb Bernhard Ströbl:
> Hi everybody,
>
> I try to do the following from the Python console:
> g=iface.activeLayer().selectedFeatures()[0].geometry()
> returns a QgsGeometry objekt but as soon as I want to do anything with
> it QGIS crashes (layer is a memory line layer but a PostGIS linestring
> layer behaves the same). Any request like
> g.type()
> g.length()
> g.anything crashes QGIS
> g.asPolyline() crash if the line has three vertices, with only two
> vertices it returns an empty array.
>
> My goal is not the Python console but a plugin; the plugin crashes, too :-(
>
> tested with 2.8 on Win7 (64bit) and 2.8 & 2.9 on Ubuntu (64 bit) so it
> should not be connected to the geometry overhaul I reckon.
>
> any help appreciated
>
> Bernhard
>
>


__________ Information from ESET Mail Security, version of virus signature database 11840 (20150625) __________

The message was checked by ESET Mail Security.
http://www.eset.com




More information about the Qgis-developer mailing list