[QGIS-Developer] [PyQGIS] Unexpected crash using: QgsFeatureRenderer.symbolForFeature()

Janvier Thomas t.janvier at brgm.fr
Thu Mar 4 02:46:26 PST 2021


Hi,

I got an issue with SIP python bindings...
I'm looking to loop over QgsVectorLayer features to convert geometries to mesh primitives (cells) ...

I had a first problem with the non-const (unexpected crash about SIP methods)
for part in feature.geometry().parts():
that I solved using the const one
 for p in f.geometry().constParts():

But now I'm facing a similar crash when trying to identify the symbol/category/legendKey of each feature
(the aim is to add the legendKey as a cell attribute to link color/LUT between the mesh and vectorlayer)
I do it this way:
layer.renderer().symbolForFeature(feature, context)

But ends up with a :

Crash ID: cb1c4f2b11cbd392a38c522a5ed1e194e060e4a0


Stack Trace


QgsExpression::evaluate :
QgsCategorizedSymbolRenderer::valueForFeature :
QgsCategorizedSymbolRenderer::originalSymbolForFeature :
PyInit__core :
PyMethodDef_RawFastCallKeywords :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyEval_EvalCodeWithName :

I opened an Issue here (not sure this is relevant):
Unexpected crash using: QgsFeatureRenderer.symbolForFeature() * Issue #68 * qgis/pyqgis (github.com)<https://github.com/qgis/pyqgis/issues/68>


Thanks a lot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210304/eb30fc43/attachment-0001.html>


More information about the QGIS-Developer mailing list