Bug report #803

segfaults editing shapefile with missing dbf file

Added by Maciej Sieczka - over 16 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Digitising
Affected QGIS version: Regression?:No
Operating System:Debian Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:10862

Description

SVN 7389.

If the shapefile is missing a dbf file and is edited in QGIS with "Move vertex tool", then "Save changes", QGIS segfaults like this:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1257305408 (LWP 15357)]
0xb68bab7f in DBFGetRecordCount () from /usr/local/lib/libgdal.so.1
(gdb) bt
#0  0xb68bab7f in DBFGetRecordCount () from /usr/local/lib/libgdal.so.1
#3905  0xb66a6bdd in SHPWriteOGRFeature () from /usr/local/lib/libgdal.so.1
#3906  0xb6688f84 in OGRShapeLayer::SetFeature () from /usr/local/lib/libgdal.so.1
#3907  0xb2f0d890 in [[QgsOgrProvider]]::changeGeometryValues (this=0x8681b48, geometry_map=@0x86a9df8) at /home/shoofi/src/straight/qgis09/src/providers/ogr/qgsogrprovider.cpp:828
#3908  0xb6f900e4 in [[QgsVectorLayer]]::commitChanges (this=0x86a9d78) at /home/shoofi/src/straight/qgis09/src/core/qgsvectorlayer.cpp:2071
#3909  0x0823bdf6 in [[QgsLegendLayerFile]]::toggleEditing (this=0x84ea230) at /home/shoofi/src/straight/qgis09/src/app/legend/qgslegendlayerfile.cpp:405
#3910  0x080f2bad in [[QgisApp]]::toggleEditing (this=0x8364208) at /home/shoofi/src/straight/qgis09/src/app/qgisapp.cpp:3547
#3911  0x0825b55c in [[QgisApp]]::qt_metacall (this=0x8364208, _c=QMetaObject::InvokeMetaMethod, _id=78, _a=0xbfe147dc) at /home/shoofi/src/straight/qgis09/build/src/app/moc_qgisapp.cxx:321
#3912  0xb7e41d67 in QMetaObject::activate (sender=0x84c37a0, from_signal_index=5, to_signal_index=6, argv=<value optimized out>) at kernel/qobject.cpp:3080
#3913  0xb7e4214e in QMetaObject::activate (sender=0x84c37a0, m=0x0, from_local_signal_index=1, to_local_signal_index=2, argv=0x0) at kernel/qobject.cpp:3159
#10 0xb766cab9 in QAction::triggered (this=0x0, _t1=false) at moc_qaction.cpp:208
#3914 0xb766d33c in QAction::activate (this=0x84c37a0, event=QAction::Trigger) at kernel/qaction.cpp:1116
#3915 0xb7a3cad6 in QToolButton::nextCheckState (this=0x0) at qaction.h:190
#3916 0xb7975455 in QAbstractButtonPrivate::click (this=0x84de7a8) at widgets/qabstractbutton.cpp:515
#3917 0xb79756af in QAbstractButton::mouseReleaseEvent (this=0x84de790, e=0xbfe14e8c) at widgets/qabstractbutton.cpp:1102
#3918 0xb7a3ca08 in QToolButton::mouseReleaseEvent (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:658
#3919 0xb76b79dd in QWidget::event (this=0x84de790, event=0xbfe14e8c) at kernel/qwidget.cpp:6080
#3920 0xb79745a6 in QAbstractButton::event (this=0x84de790, e=0xbfe14e8c) at widgets/qabstractbutton.cpp:1064
#3921 0xb7a3c876 in QToolButton::event (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:1075
#3922 0xb7672be3 in QApplicationPrivate::notify_helper (this=0x82e96e8, receiver=0x84de790, e=0xbfe14e8c) at kernel/qapplication.cpp:3558
#3923 0xb7675ff8 in QApplication::notify (this=0xbfe155dc, receiver=0x84de790, e=0xbfe14e8c) at kernel/qapplication.cpp:3257
#3924 0xb7e30f64 in QCoreApplication::notifyInternal (this=0xbfe155dc, receiver=0x84de790, event=0xbfe14e8c) at kernel/qcoreapplication.cpp:532
#3925 0xb76cebd7 in QETWidget::translateMouseEvent (this=0x84de790, event=0xbfe151ec) at qcoreapplication.h:205
#3926 0xb76ce4ab in QApplication::x11ProcessEvent (this=0xbfe155dc, event=0xbfe151ec) at kernel/qapplication_x11.cpp:2917
#3927 0xb76f2dab in x11EventSourceDispatch (s=0x830b258, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:137
#3928 0xb62f58d6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#3929 0xb62f8996 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#3930 0xb62f8e1e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3931 0xb7e543b5 in QEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0xbfe153d8) at kernel/qeventdispatcher_glib.cpp:340
#3932 0xb76f2957 in QGuiEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0x86eb8c8) at kernel/qguieventdispatcher_glib.cpp:193
#3933 0xb7e30873 in QEventLoop::processEvents (this=0x0, flags=@0x0) at kernel/qeventloop.cpp:141
#3934 0xb7e309b2 in QEventLoop::exec (this=0xbfe15470, flags=@0xbfe15478) at kernel/qeventloop.cpp:187
#3935 0xb7e32e29 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:752
#3936 0xb76726c7 in QApplication::exec () at kernel/qapplication.cpp:3055
#3937 0x080dd0e2 in main (argc=1, argv=0xbfe15824) at /home/shoofi/src/straight/qgis09/src/app/main.cpp:631
(gdb)

If the same shapefile is edited with "Delete Selected" or "Cut Features", then "Save Changes" QGIS segfaults in another fashion:

ERROR 1: Attempt to delete shape in shapefile with no .dbf file.
Deletion is done by marking record deleted in dbf
and is not supported without a .dbf file.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1256682816 (LWP 15343)]
0xb6953761 in DBFIsRecordDeleted () from /usr/local/lib/libgdal.so.1
(gdb) bt
#0  0xb6953761 in DBFIsRecordDeleted () from /usr/local/lib/libgdal.so.1
#3905  0xb67221b1 in OGRShapeLayer::Repack () from /usr/local/lib/libgdal.so.1
#3906  0xb671f369 in OGRShapeDataSource::ExecuteSQL () from /usr/local/lib/libgdal.so.1
#3907  0xb2fa3b39 in [[QgsOgrProvider]]::deleteFeatures (this=0x8362a30, id=@0x869cc0c) at /home/shoofi/src/straight/qgis09/src/providers/ogr/qgsogrprovider.cpp:870
#3908  0xb70282ea in [[QgsVectorLayer]]::commitChanges (this=0x869cb98) at /home/shoofi/src/straight/qgis09/src/core/qgsvectorlayer.cpp:2101
#3909  0x0823bdf6 in [[QgsLegendLayerFile]]::toggleEditing (this=0x84ef140) at /home/shoofi/src/straight/qgis09/src/app/legend/qgslegendlayerfile.cpp:405
#3910  0x080f2bad in [[QgisApp]]::toggleEditing (this=0x8363cc8) at /home/shoofi/src/straight/qgis09/src/app/qgisapp.cpp:3547
#3911  0x0825b55c in [[QgisApp]]::qt_metacall (this=0x8363cc8, _c=QMetaObject::InvokeMetaMethod, _id=78, _a=0xbfaaca9c) at /home/shoofi/src/straight/qgis09/build/src/app/moc_qgisapp.cxx:321
#3912  0xb7ed9d67 in QMetaObject::activate (sender=0x84c3080, from_signal_index=5, to_signal_index=6, argv=<value optimized out>) at kernel/qobject.cpp:3080
#3913  0xb7eda14e in QMetaObject::activate (sender=0x84c3080, m=0x0, from_local_signal_index=1, to_local_signal_index=2, argv=0x0) at kernel/qobject.cpp:3159
#10 0xb7704ab9 in QAction::triggered (this=0x0, _t1=false) at moc_qaction.cpp:208
#3914 0xb770533c in QAction::activate (this=0x84c3080, event=QAction::Trigger) at kernel/qaction.cpp:1116
#3915 0xb7ad4ad6 in QToolButton::nextCheckState (this=0x0) at qaction.h:190
#3916 0xb7a0d455 in QAbstractButtonPrivate::click (this=0x84de728) at widgets/qabstractbutton.cpp:515
#3917 0xb7a0d6af in QAbstractButton::mouseReleaseEvent (this=0x84de710, e=0xbfaad14c) at widgets/qabstractbutton.cpp:1102
#3918 0xb7ad4a08 in QToolButton::mouseReleaseEvent (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:658
#3919 0xb774f9dd in QWidget::event (this=0x84de710, event=0xbfaad14c) at kernel/qwidget.cpp:6080
#3920 0xb7a0c5a6 in QAbstractButton::event (this=0x84de710, e=0xbfaad14c) at widgets/qabstractbutton.cpp:1064
#3921 0xb7ad4876 in QToolButton::event (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:1075
#3922 0xb770abe3 in QApplicationPrivate::notify_helper (this=0x82e96e8, receiver=0x84de710, e=0xbfaad14c) at kernel/qapplication.cpp:3558
#3923 0xb770dff8 in QApplication::notify (this=0xbfaad89c, receiver=0x84de710, e=0xbfaad14c) at kernel/qapplication.cpp:3257
#3924 0xb7ec8f64 in QCoreApplication::notifyInternal (this=0xbfaad89c, receiver=0x84de710, event=0xbfaad14c) at kernel/qcoreapplication.cpp:532
#3925 0xb7766bd7 in QETWidget::translateMouseEvent (this=0x84de710, event=0xbfaad4ac) at qcoreapplication.h:205
#3926 0xb77664ab in QApplication::x11ProcessEvent (this=0xbfaad89c, event=0xbfaad4ac) at kernel/qapplication_x11.cpp:2917
#3927 0xb778adab in x11EventSourceDispatch (s=0x830b258, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:137
#3928 0xb638d8d6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#3929 0xb6390996 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#3930 0xb6390e1e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3931 0xb7eec3b5 in QEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0xbfaad698) at kernel/qeventdispatcher_glib.cpp:340
#3932 0xb778a957 in QGuiEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0x868e738) at kernel/qguieventdispatcher_glib.cpp:193
#3933 0xb7ec8873 in QEventLoop::processEvents (this=0x0, flags=@0x0) at kernel/qeventloop.cpp:141
#3934 0xb7ec89b2 in QEventLoop::exec (this=0xbfaad730, flags=@0xbfaad738) at kernel/qeventloop.cpp:187
#3935 0xb7ecae29 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:752
#3936 0xb770a6c7 in QApplication::exec () at kernel/qapplication.cpp:3055
#3937 0x080dd0e2 in main (argc=1, argv=0xbfaadae4) at /home/shoofi/src/straight/qgis09/src/app/main.cpp:631
(gdb)

To avoid this QGIS should not let edit broken shapefiles or at least should refuse to load them.

Associated revisions

Revision 73e2713e
Added by Jürgen Fischer over 16 years ago

negate write capabilities for shapefiles w/o attributes, fixes #803

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7612 c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision bf62b396
Added by Jürgen Fischer over 16 years ago

negate write capabilities for shapefiles w/o attributes, fixes #803

git-svn-id: http://svn.osgeo.org/qgis/trunk@7612 c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#1 Updated by Jürgen Fischer over 16 years ago

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

fixed in bf62b396 (SVN r7613)

#2 Updated by Anonymous over 14 years ago

Milestone Version 0.9.1 deleted

Also available in: Atom PDF