Bug report #5584

QGIS crashes saving a vector with an empty geometry

Added by Giovanni Manghi over 12 years ago. Updated over 11 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Marco Hugentobler
Category:Digitising
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:Yes Copied to github as #:15161

Description

See the attached sample project. Open it.
  • You will see a "pda" shape polygon layer that is empty
  • Try digitize the pond you will see in the WMS layer used as background.
  • Finish editing, the feature does not show in the canvas.
  • Toggle editing off, choose "save", qgis crashes.

Message is

gio@sibirica:~$ qgis
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_US]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_US]
Segmentation fault (core dumped)
gio@sibirica:~$ 

happens also on Windows/osgeo4w but at this stage I don't know if is a regression as I tested only master.

project_test.tar.gz (11 KB) Giovanni Manghi, 2012-05-13 01:31 PM


Related issues

Duplicated by QGIS Application - Bug report #5917: QGIS crashes when digitizing vector sets Closed 2012-06-30

History

#1 Updated by Giovanni Manghi over 12 years ago

very odd... if in the attached project I remove (not only unselect) the layer "limites", then it work all as expected.

#2 Updated by Marco Hugentobler over 12 years ago

  • Priority changed from Severe/Regression to Normal

The problem is that in Settings->Snapping options, avoid intersection is switched on for the layer 'limites'. Therefore, because the pond is entirely covered by the layer limites, the created geometry is empty.

Though I agree a fix is needed to either reject features with empty geometry or to avoid the crash when clicking 'save'.

#3 Updated by Giovanni Manghi over 12 years ago

Hi Marco,

Marco Hugentobler wrote:

The problem is that in Settings->Snapping options, avoid intersection is switched on for the layer 'limites'. Therefore, because the pond is entirely covered by the layer limites, the created geometry is empty.

yes I knew it, I just forgot to mention the "detail"... obviously the bug surfaced when I had qgis snapping/intersection wrongly configurated for what I was doing.

Though I agree a fix is needed to either reject features with empty geometry or to avoid the crash when clicking 'save'.

Right, it is not a regression... just tested 1.7.4 and the problem is there too.

#4 Updated by Giovanni Manghi over 12 years ago

  • Subject changed from QGIS crashes on saving a vector when editing to QGIS crashes saving a vector with an empty geometry

#5 Updated by Salvatore Larosa over 12 years ago

with project attached, following the steps above, everythings works fine here!
the feature is shown properly!
in current master!

#6 Updated by Salvatore Larosa over 12 years ago

Sorry my fault, I digitized to the outside of the polygon limites and has worked!
If I digitize pond in view I get segfault as Giovanni said!

#7 Updated by Giovanni Manghi over 12 years ago

see also #5917

#8 Updated by Paolo Cavallini about 12 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#9 Updated by Giovanni Manghi about 12 years ago

Issue confirmed on latest master.

#10 Updated by Giovanni Manghi about 12 years ago

  • Priority changed from Normal to High

#11 Updated by Giovanni Manghi almost 12 years ago

  • Priority changed from High to Severe/Regression

I'll tag this as blocker because this is a regression since 1.6, in fact in that version of qgis when adding a polygon that is supposed to be entirely removed because of the "avoid intersection" option, a message popped out

The feature could not be added because removing the polygon intersections would change the geometry type

and so avoiding to add an empty geometry and avoiding the crash.

#12 Updated by Marco Hugentobler almost 12 years ago

  • Status changed from Open to Closed

I'm assuming this was with ogr data sources? If so, fixed in 96a8bd64d8cdd4aecdf9e0789d525cf09f44e6a1 (if not, please reopen)

#13 Updated by Giovanni Manghi almost 12 years ago

  • Status changed from Closed to Reopened

Marco Hugentobler wrote:

I'm assuming this was with ogr data sources? If so, fixed in 96a8bd64d8cdd4aecdf9e0789d525cf09f44e6a1 (if not, please reopen)

Hi Marco,
the crash is fixed, but the result of saving a vector a vector with an empty geometry is a table of attributes with a orphaned record... with no geometry associated. I don't think that this is right, but I may be wrong. In this case please re-close this ticket.

cheers

-- Giovanni --

#14 Updated by Marco Hugentobler almost 12 years ago

Code wise, it is no problem to skip the feature. I don't know how it is from a user perspective (if rejection is prefered or a feature with empty geometry)

#15 Updated by Giovanni Manghi almost 12 years ago

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

Marco Hugentobler wrote:

Code wise, it is no problem to skip the feature. I don't know how it is from a user perspective (if rejection is prefered or a feature with empty geometry)

well if the data model admits records with no geometries then I think there nothing wrong.

#16 Updated by Giovanni Manghi over 11 years ago

  • Assignee set to Marco Hugentobler
  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

Marco Hugentobler wrote:

Code wise, it is no problem to skip the feature. I don't know how it is from a user perspective (if rejection is prefered or a feature with empty geometry)

Hi Marco,
after having made a few tests, and after having shared opinions with many others, I believe that the best solution is to reject the feature and avoid to have a record in the table of attributes with no geometry. It would much better (if not mandatory) to let the user know why its feature is going to be rejected (with a notification as they are available now in qgis master?).

#17 Updated by Giovanni Manghi over 11 years ago

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

Also available in: Atom PDF