Bug report #3159

invalid geometry in python console crashes qgis

Added by Alessandro Pasotti over 13 years ago. Updated over 13 years ago.

Status:Closed
Priority:Low
Assignee:Borys Jurgiel
Category:Python plugins
Affected QGIS version: Regression?:No
Operating System:Debian Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:13219

Description

Open Qgis

Start python Console

Enter and execute this code:

l=qgis.core.QgsVectorLayer("Point", "QPoint", "memory")
l.dataProvider().addFeatures([qgis.core.QgsFeature(qgis.core.QgsGeometry().fromWkt('POINT(9 , 45)'))])

An "unknown exception" message appears and python console hangs

Close python console

Re-start python console

Segmentation fault

(note: invalid WKT)

History

#1 Updated by Borys Jurgiel over 13 years ago

Well, I can't replicate here (Python 2.6.5) - the error is handled properly.

#2 Updated by Alessandro Pasotti over 13 years ago

Here:


Python 2.6.5 (commit:0f397015 (SVN r266):79063, Apr 16 2010, 13:57:41) 

$ apt-cache policy qgis
qgis:
  Installato: 1.5.0-2~lucid2
  Candidato: 1.5.0-2~lucid2
  Tabella versione:
 *** 1.5.0-2~lucid2 0
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ lucid/main

$ apt-cache policy libgeos-c1
libgeos-c1:
  Installato: 3.2.2-2~lucid1
  Candidato: 3.2.2-2~lucid1
  Tabella versione:
 *** 3.2.2-2~lucid1 0
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ lucid/main 

#3 Updated by Martin Dobias over 13 years ago

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

The whole correct code would be:
<pre>
g = qgis.core.QgsGeometry.fromWkt('POINT(9 45)')
f = qgis.core.QgsFeature()
f.setGeometry(g)
l=qgis.core.QgsVectorLayer("Point", "QPoint", "memory")
l.dataProvider().addFeatures([f])
</pre>

Also available in: Atom PDF