#957 closed bug (fixed)
QGIS crashes when trying to export shapefile from Postgis where record has NULL geometry
Reported by: | neumann | Owned by: | nobody |
---|---|---|---|
Priority: | critical: causes crash or data corruption | Milestone: | |
Component: | Build/Install | Version: | Trunk |
Keywords: | crash on shape export null geometry | Cc: | warmerdam |
Must Fix for Release: | Yes | Platform: | Debian |
Platform Version: | Awaiting user input: | no |
Description
When exporting data from Postgis to a shapefile and one or more records have a NULL geometry it seems like QGIS crashes during the export. Attached is a sample SQL file where one record (the one with gid=450) has a NULL geometry.
To reproduce, create an empty Postgis database and a schema called "natur". Then import the file attached to this bug with "psql -U an -d yourdb -f oekoflaech.sql" --> add the file to QGIS --> right click on the layer and --> Save as shapefile --> QGIS crashes.
This is consistent on both Linux and Windows with a fairly recent SVN version.
Attachments (1)
Change History (7)
by , 16 years ago
Attachment: | oekoflaech.sql.gz added |
---|
comment:1 by , 16 years ago
Cc: | added |
---|
comment:2 by , 16 years ago
I don't have a postgis instance readily available, so I tried to reproduce this by opening a new vector layer from a .csv file (no geometries) and then doing "save to shapefile" from the layer entry in the layer list. This seemed to work ok though no actual records were written - presumably because none of them had geometry.
This leads me to wonder if the problem is specific to postgis or if I'm just approaching it wrong.
comment:3 by , 16 years ago
racicot reports this traceback:
Program received signal SIGABRT, Aborted. [Switching to Thread -1259669824 (LWP 19480)] 0xffffe410 in __kernel_vsyscall () (gdb) bt #0 0xffffe410 in __kernel_vsyscall () #1 0xb6271875 in raise () from /lib/tls/i686/cmov/libc.so.6 #2 0xb6273201 in abort () from /lib/tls/i686/cmov/libc.so.6 #3 0xb626ab6e in __assert_fail () from /lib/tls/i686/cmov/libc.so.6 #4 0xb6ed0715 in QgsVectorFileWriter::createEmptyGeometry (this=0x88fdd68, wkbType=QGis::WKBUnknown) at /usr/local/src/qgis/qgis_svn/src/core/qgsvectorfilewriter.cpp:176 #5 0xb6ed0d86 in QgsVectorFileWriter::addFeature (this=0x88fdd68, feature=@0xbfbea084) at /usr/local/src/qgis/qgis_svn/src/core/qgsvectorfilewriter.cpp:244 #6 0xb6ed208e in QgsVectorFileWriter::writeAsShapefile (layer=0x8896e88, shapefileName=@0xbfbea12c, fileEncoding=@0xbfbea130, onlySelected=false) at /usr/local/src/qgis/qgis_svn/src/core/qgsvectorfilewriter.cpp:329 #7 0x0828368c in QgsLegendLayerFile::saveAsShapefileGeneral (this=0x88b0180, saveOnlySelection=false) at /usr/local/src/qgis/qgis_svn/src/app/legend/qgslegendlayerfile.cpp:387
comment:4 by , 16 years ago
So, the problem is triggered by passing something unexpected (like wkbNone or equivelent?) into createEmptyGeometry(). This method is substantially restructured in the gdalogr-capi branch and I'm not sure the problem will still exist there.
If that will be merged soon, I would suggest holding this ticket till after that merge.
comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
A sample Postgis SQL file where one row has a null geometry