Bug report #7612

Crash with 'Save as..' option

Added by Pedro Venâncio over 9 years ago. Updated over 9 years ago.

Affected QGIS version:master Regression?:No
Operating System:Xubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16540


I have been attempt to find the source of this problem a few days ago, but still could not quite understand what is the origin. The only pattern I find is that always happens with fields of type "Real" with Precision greater than 0.

I attached a shapefile of test.
To reproduce the error, open the shape, make Save as... (Save vector layer as...) and try to save. With this procedure, QGIS crashes with a Segmentation fault (core dumped).

The problem is with the field "m2". But I can not understand what is wrong in this field that may be causing the problem. This happens to me with many type of layers, including PostGIS, SpatiaLite or Shapefile layers.

With exactly the same layers, QGIS 1.8 works fine, without any error. So I think it is a regression.

crash.zip (9.97 KB) Pedro Venâncio, 2013-04-14 01:46 PM

test.zip (3.67 KB) Martin Jung, 2013-04-15 03:20 AM


#1 Updated by Pedro Venâncio over 9 years ago

I'm almost 100% sure that this problem is caused by the Lecos Plugin (v1.7.2). With this plugin disabled, the 'Save as' works without problems.

Anyone confirm?

#2 Updated by Martin Jung over 9 years ago

With your Shape -> Confirmed.
With other different shapes -> Not confirmed (see the attached example polygon and point shapes, which work at least for me without issues)

As the plugins author i don't really see what i can do as the "save as" function is an internal c++ function of QGIS and at least to my understanding those functions shouldn't be affected by plugin python code.
At least i have no idea how to fix this kind of error... :-(

System: Debian Wheezy - QGIS dev

#3 Updated by Pedro Venâncio over 9 years ago

Hi Martin,

This crash does not occur with all layers, but occurs in a large set of tests that I did.

Honestly, I also can not understand how a plugin can cause this type of problem, but the truth is that the crash occurs with LecoS active and disappears with its deactivation.


#4 Updated by Martin Jung over 9 years ago


i just tested your shapefile on Windows using both QGIS 1.8 Lisboa and QGIS dev. "Saving" your layer results in a crash for both stable and development. In your bug report you mentioned that it worked for you on your QGIS 1.8 stable.
Can you please provide the details (library versions -> make screenshot of the QGIS about dialog) of your QGIS 1.8 version?

I have no idea what the reason for this error is, but i assume that it has something to do with gdal or ogr.

#5 Updated by Pedro Venâncio over 9 years ago

Hi Martin,

The reason to not crash in version 1.8 is because I do not have the LecoS plugin installed there.

#6 Updated by Martin Jung over 9 years ago

  • % Done changed from 0 to 100


i got it fixed! Or at least your example point shape isn't causing QGIS to crash anymore while LecoS is activated.
I tried multiple random things and finally found the reason. It appears to be the call of gdal.UseExceptions() and/or ogr.UseExceptions()
I will soon upload a bug fix where those lines are commented in every script.

About the real Reason:
Maybe it is a bug with the gdal/ogr python libraries.

#7 Updated by Pedro Venâncio over 9 years ago

  • Status changed from Open to Closed

Hi Martin,

It's fixed!

Thank you very much!!

Also available in: Atom PDF