Bug report #9208

QGIS crashes when using addAttributes on any vector data provider

Added by Giovanni Allegri almost 11 years ago. Updated about 9 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Data Provider
Affected QGIS version:2.0.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:17833

Description

During a course students with QGIS Dufour 64 bit (on Windows 7) reported crashes when using QgsVectorDataProvider::addAttributes() method. It happens whatever provider we use.

QGIS receives an OS signal and generates the following minidump: https://dl.dropboxusercontent.com/u/13861666/qgis-20131212-123926-2704-6552-d94c044.dmp

The same code works fine on QGIS 32bit.

OS: Windows 7
QGIS 2.0.1 (both from OSGeo4W and Standalone)
commit:d94c044

a_polygon.zip (1.54 KB) Jürgen Fischer, 2015-10-16 08:18 AM

test_dump.py Magnifier (348 Bytes) Jürgen Fischer, 2015-10-16 08:19 AM

Associated revisions

Revision 3e0badcb
Added by Jürgen Fischer about 9 years ago

Fix sip conversion from QgsFields to QList<QgsField> (fixes #9208)

History

#1 Updated by Giovanni Manghi almost 11 years ago

  • Priority changed from Normal to High
  • Crashes QGIS or corrupts data changed from No to Yes

#2 Updated by Jürgen Fischer almost 11 years ago

  • Subject changed from QGIS for Windows 64bit crashes when using addSttributes on any vector data provider to QGIS for Windows 64bit crashes when using addAttributes on any vector data provider

#3 Updated by Jürgen Fischer over 10 years ago

  • Status changed from Open to Feedback

Can you provide more detail? Doesn't crash here.

#4 Updated by Giovanni Allegri over 10 years ago

Here you can find a test shapefile [1] and a tiny test script [2]. I've just tested it with QGIS 64bit through the python console, on Windows 8, and it crashes.

[1]https://dl.dropboxusercontent.com/u/13861666/qgis64_crash/a_polygon.zip
[2]https://dl.dropboxusercontent.com/u/13861666/qgis64_crash/test_dump.py

#5 Updated by Giovanni Allegri over 10 years ago

PS: it's just a test. In general I do changes to the layers in an editing session. I just wanted to report two things:
  • different behaviour between 32 bit and 64 bit. The first works fine.
  • a crash shouldn't happen. In case it's an errroneus operation it should communicate it without crashing.

#6 Updated by Jürgen Fischer over 10 years ago

Giovanni Allegri wrote:

Here you can find a test shapefile [1] and a tiny test script [2]. I've just tested it with QGIS 64bit through the python console, on Windows 8, and it crashes.

[1]https://dl.dropboxusercontent.com/u/13861666/qgis64_crash/a_polygon.zip
[2]https://dl.dropboxusercontent.com/u/13861666/qgis64_crash/test_dump.py

um, I wonder why pr.addAttributes( origFields ) works at all - as it should be pr.addAttributes( origFields.toList() ). That works. So it's probably some casting smartness going on that leads to the crash...

#7 Updated by Giovanni Allegri over 10 years ago

I'm not expert with SIP. I thought QgsFields were automatically casted to lists by the SIP wrapper, but I see that getitem method is commented. [1]
It would more pythonic ig QgsFields were treated as lists without having to call the .toList() method.

[1] https://github.com/qgis/QGIS/blob/master/python/core/qgsfield.sip#L188

#8 Updated by Jürgen Fischer over 10 years ago

  • OS version deleted (64 bit)
  • Operating System deleted (Windows)

Also reproducable on Linux

#9 Updated by Giovanni Allegri over 10 years ago

It doesn't happen with QGIS 32bit on Windows (at least on my machine)

#10 Updated by Giovanni Manghi over 10 years ago

  • Subject changed from QGIS for Windows 64bit crashes when using addAttributes on any vector data provider to QGIS crashes when using addAttributes on any vector data provider
  • Status changed from Feedback to Open

#11 Updated by Sandro Santilli almost 10 years ago

I don't know if this is the same bug but I got crashes when trying to add fields to either a PostGIS or a Spatialite table.
The crash happens when leaving "edit mode" right after saving the changes sent this error:

 Errors: SUCCESS: 3 attribute(s) added. ERROR: 8 attribute value change(s) not applied. 
   Provider errors:                                                             
       PostGIS error while changing attributes: ERROR:  syntax error at or near "WHERE" 
     LINE 1: UPDATE "public"."rotation_test" SET  WHERE ctid='(0,0)'            
                                                  ^                

#12 Updated by Sandro Santilli almost 10 years ago

If it is the same, this is happening in master, pre-2.8.0, on a 64bit linux

#13 Updated by Sandro Santilli almost 10 years ago

  • Tag set to attributes

#14 Updated by Jürgen Fischer about 9 years ago

  • Status changed from Open to Feedback

#15 Updated by Jürgen Fischer about 9 years ago

#16 Updated by Jürgen Fischer about 9 years ago

  • Status changed from Feedback to Open

#17 Updated by Jürgen Fischer about 9 years ago

#18 Updated by Jürgen Fischer about 9 years ago

  • File deleted (test_dump.py)

#19 Updated by Jürgen Fischer about 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF