Bug report #20261

python script crashes QGIS

Added by Theresa Lichtenberger about 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:High
Assignee:-
Category:PyQGIS Console
Affected QGIS version:2.18.17 Regression?:No
Operating System:Windows10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:28082

Description

I have written a python script which has two input vector layers (one point-layer and one line-layer). The outpout is another line-layer. But when I try too set the geometry for the new edge, the python script stopps and I get the error "minidump written to C".

Here is my python script code:

https://gis.stackexchange.com/questions/300562/qgis-python-script-crashed-with-minidump-written-to-c

With the help of printf-Debugging, I have figured out that the crash is caused by this line:

-> newEdge.setGeometry(QgsGeometry.fromPolyline([geomFrom.asPoint(),geomTo.asPoint()]))

I have already deleted the .qgis2-folder and started qgis 2.18 anew. But without success.

Any suggestions?

merge_edges.py Magnifier - python script file (5 KB) Theresa Lichtenberger, 2018-10-29 03:06 PM

History

#1 Updated by Giovanni Manghi about 6 years ago

  • Subject changed from QGIS python script crashed with minidump written to C to python script crashes QGIS

#2 Updated by Nyall Dawson about 6 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

This is fixed in QGIS 3.0

In 2.x it's necessary to make an explicit copy of all geometries you capture from features, e.g.

geomFrom = QgsGeometry(feat2.geometry())

Also available in: Atom PDF