Opened 14 years ago

Closed 13 years ago

#3159 closed bug (fixed)

invalid geometry in python console crashes qgis

Reported by: elpaso Owned by: borysiasty
Priority: critical: causes crash or data corruption Milestone: Version 1.7.0
Component: Python plugins and bindings Version: 1.5.0
Keywords: Cc:
Must Fix for Release: No Platform: Debian
Platform Version: lucid lynx 64bit Awaiting user input: no

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)

Change History (3)

comment:1 by borysiasty, 13 years ago

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

comment:2 by elpaso, 13 years ago

Platform Version: lucid lynx 64bit

Here:

Python 2.6.5 (r265: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 


comment:3 by wonder, 13 years ago

Milestone: Version 1.6.0Version 1.7.0
Resolution: fixed
Status: newclosed

The problem should be fixed in r14904 - there was an unhandled exception from GEOS - the WKT should read POINT(9 45) - with no comma between the coordinates.

The whole correct code would be:

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])
Note: See TracTickets for help on using tickets.