#803 closed bug (fixed)
segfaults editing shapefile with missing dbf file
Reported by: | msieczka | Owned by: | nobody |
---|---|---|---|
Priority: | critical: causes crash or data corruption | Milestone: | |
Component: | Digitising | Version: | Trunk |
Keywords: | Cc: | ||
Must Fix for Release: | Yes | Platform: | Debian |
Platform Version: | Awaiting user input: | no |
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 #1 0xb66a6bdd in SHPWriteOGRFeature () from /usr/local/lib/libgdal.so.1 #2 0xb6688f84 in OGRShapeLayer::SetFeature () from /usr/local/lib/libgdal.so.1 #3 0xb2f0d890 in QgsOgrProvider::changeGeometryValues (this=0x8681b48, geometry_map=@0x86a9df8) at /home/shoofi/src/straight/qgis09/src/providers/ogr/qgsogrprovider.cpp:828 #4 0xb6f900e4 in QgsVectorLayer::commitChanges (this=0x86a9d78) at /home/shoofi/src/straight/qgis09/src/core/qgsvectorlayer.cpp:2071 #5 0x0823bdf6 in QgsLegendLayerFile::toggleEditing (this=0x84ea230) at /home/shoofi/src/straight/qgis09/src/app/legend/qgslegendlayerfile.cpp:405 #6 0x080f2bad in QgisApp::toggleEditing (this=0x8364208) at /home/shoofi/src/straight/qgis09/src/app/qgisapp.cpp:3547 #7 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 #8 0xb7e41d67 in QMetaObject::activate (sender=0x84c37a0, from_signal_index=5, to_signal_index=6, argv=<value optimized out>) at kernel/qobject.cpp:3080 #9 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 #11 0xb766d33c in QAction::activate (this=0x84c37a0, event=QAction::Trigger) at kernel/qaction.cpp:1116 #12 0xb7a3cad6 in QToolButton::nextCheckState (this=0x0) at qaction.h:190 #13 0xb7975455 in QAbstractButtonPrivate::click (this=0x84de7a8) at widgets/qabstractbutton.cpp:515 #14 0xb79756af in QAbstractButton::mouseReleaseEvent (this=0x84de790, e=0xbfe14e8c) at widgets/qabstractbutton.cpp:1102 #15 0xb7a3ca08 in QToolButton::mouseReleaseEvent (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:658 #16 0xb76b79dd in QWidget::event (this=0x84de790, event=0xbfe14e8c) at kernel/qwidget.cpp:6080 #17 0xb79745a6 in QAbstractButton::event (this=0x84de790, e=0xbfe14e8c) at widgets/qabstractbutton.cpp:1064 #18 0xb7a3c876 in QToolButton::event (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:1075 #19 0xb7672be3 in QApplicationPrivate::notify_helper (this=0x82e96e8, receiver=0x84de790, e=0xbfe14e8c) at kernel/qapplication.cpp:3558 #20 0xb7675ff8 in QApplication::notify (this=0xbfe155dc, receiver=0x84de790, e=0xbfe14e8c) at kernel/qapplication.cpp:3257 #21 0xb7e30f64 in QCoreApplication::notifyInternal (this=0xbfe155dc, receiver=0x84de790, event=0xbfe14e8c) at kernel/qcoreapplication.cpp:532 #22 0xb76cebd7 in QETWidget::translateMouseEvent (this=0x84de790, event=0xbfe151ec) at qcoreapplication.h:205 #23 0xb76ce4ab in QApplication::x11ProcessEvent (this=0xbfe155dc, event=0xbfe151ec) at kernel/qapplication_x11.cpp:2917 #24 0xb76f2dab in x11EventSourceDispatch (s=0x830b258, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:137 #25 0xb62f58d6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #26 0xb62f8996 in g_main_context_check () from /usr/lib/libglib-2.0.so.0 #27 0xb62f8e1e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #28 0xb7e543b5 in QEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0xbfe153d8) at kernel/qeventdispatcher_glib.cpp:340 #29 0xb76f2957 in QGuiEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0x86eb8c8) at kernel/qguieventdispatcher_glib.cpp:193 #30 0xb7e30873 in QEventLoop::processEvents (this=0x0, flags=@0x0) at kernel/qeventloop.cpp:141 #31 0xb7e309b2 in QEventLoop::exec (this=0xbfe15470, flags=@0xbfe15478) at kernel/qeventloop.cpp:187 #32 0xb7e32e29 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:752 #33 0xb76726c7 in QApplication::exec () at kernel/qapplication.cpp:3055 #34 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 #1 0xb67221b1 in OGRShapeLayer::Repack () from /usr/local/lib/libgdal.so.1 #2 0xb671f369 in OGRShapeDataSource::ExecuteSQL () from /usr/local/lib/libgdal.so.1 #3 0xb2fa3b39 in QgsOgrProvider::deleteFeatures (this=0x8362a30, id=@0x869cc0c) at /home/shoofi/src/straight/qgis09/src/providers/ogr/qgsogrprovider.cpp:870 #4 0xb70282ea in QgsVectorLayer::commitChanges (this=0x869cb98) at /home/shoofi/src/straight/qgis09/src/core/qgsvectorlayer.cpp:2101 #5 0x0823bdf6 in QgsLegendLayerFile::toggleEditing (this=0x84ef140) at /home/shoofi/src/straight/qgis09/src/app/legend/qgslegendlayerfile.cpp:405 #6 0x080f2bad in QgisApp::toggleEditing (this=0x8363cc8) at /home/shoofi/src/straight/qgis09/src/app/qgisapp.cpp:3547 #7 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 #8 0xb7ed9d67 in QMetaObject::activate (sender=0x84c3080, from_signal_index=5, to_signal_index=6, argv=<value optimized out>) at kernel/qobject.cpp:3080 #9 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 #11 0xb770533c in QAction::activate (this=0x84c3080, event=QAction::Trigger) at kernel/qaction.cpp:1116 #12 0xb7ad4ad6 in QToolButton::nextCheckState (this=0x0) at qaction.h:190 #13 0xb7a0d455 in QAbstractButtonPrivate::click (this=0x84de728) at widgets/qabstractbutton.cpp:515 #14 0xb7a0d6af in QAbstractButton::mouseReleaseEvent (this=0x84de710, e=0xbfaad14c) at widgets/qabstractbutton.cpp:1102 #15 0xb7ad4a08 in QToolButton::mouseReleaseEvent (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:658 #16 0xb774f9dd in QWidget::event (this=0x84de710, event=0xbfaad14c) at kernel/qwidget.cpp:6080 #17 0xb7a0c5a6 in QAbstractButton::event (this=0x84de710, e=0xbfaad14c) at widgets/qabstractbutton.cpp:1064 #18 0xb7ad4876 in QToolButton::event (this=0x0, e=0x0) at widgets/qtoolbutton.cpp:1075 #19 0xb770abe3 in QApplicationPrivate::notify_helper (this=0x82e96e8, receiver=0x84de710, e=0xbfaad14c) at kernel/qapplication.cpp:3558 #20 0xb770dff8 in QApplication::notify (this=0xbfaad89c, receiver=0x84de710, e=0xbfaad14c) at kernel/qapplication.cpp:3257 #21 0xb7ec8f64 in QCoreApplication::notifyInternal (this=0xbfaad89c, receiver=0x84de710, event=0xbfaad14c) at kernel/qcoreapplication.cpp:532 #22 0xb7766bd7 in QETWidget::translateMouseEvent (this=0x84de710, event=0xbfaad4ac) at qcoreapplication.h:205 #23 0xb77664ab in QApplication::x11ProcessEvent (this=0xbfaad89c, event=0xbfaad4ac) at kernel/qapplication_x11.cpp:2917 #24 0xb778adab in x11EventSourceDispatch (s=0x830b258, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:137 #25 0xb638d8d6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #26 0xb6390996 in g_main_context_check () from /usr/lib/libglib-2.0.so.0 #27 0xb6390e1e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #28 0xb7eec3b5 in QEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0xbfaad698) at kernel/qeventdispatcher_glib.cpp:340 #29 0xb778a957 in QGuiEventDispatcherGlib::processEvents (this=0x83080e0, flags=@0x868e738) at kernel/qguieventdispatcher_glib.cpp:193 #30 0xb7ec8873 in QEventLoop::processEvents (this=0x0, flags=@0x0) at kernel/qeventloop.cpp:141 #31 0xb7ec89b2 in QEventLoop::exec (this=0xbfaad730, flags=@0xbfaad738) at kernel/qeventloop.cpp:187 #32 0xb7ecae29 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:752 #33 0xb770a6c7 in QApplication::exec () at kernel/qapplication.cpp:3055 #34 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.
Note:
See TracTickets
for help on using tickets.
fixed in r7612