Bug report #18812

QGIS 3.0.1 crashes after attempting to remove a virtual field from a shapefile

Added by Carolyn Krause over 6 years ago. Updated over 5 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Virtual Fields
Affected QGIS version:3.0.1 Regression?:No
Operating System:Windows 10 Pro Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:26698

Description

User Feedback

QGIS crashed when I tried to delete a virtual field from a shapefile.

I experienced two other issues with virtual fields in the same project session, not sure if they're related or not but I include details on those issues in case its helpful.

I added the virtual field when the shapefile was in edit mode. Every time I tried to save edits made to the shapefile, it gave an error along the lines of "unexpected number of fields, expecting 4 fields but found 5" (not exact quote).

In the same project session, I added a second virtual field to another shapefile. This virtual field used intersecting_geom_sum() function (from refFunctions plugin) to add up values of the first virtual field. This second virtual field worked correctly for existing features, but when I added new features they had null values in this field, even after saving edits.

Report Details

Crash ID: 84c7c6b755ec11e924fcdec028d9c727b122a106

Stack Trace

QgsField::QgsField :
QgsFieldConstraints::~QgsFieldConstraints :
QgsSymbolsListWidget::groupsCombo_currentIndexChanged :
QMetaObject::activate :
QMetaObject::activate :
QMetaObject::activate :
QMetaObject::activate :
QgsTextEditWrapper::setValue :
QgsAttributeForm::resetValues :
QgsAttributeForm::setFeature :
QgsDualView::mFeatureList_currentEditSelectionChanged :
QgsSymbolsListWidget::groupsCombo_currentIndexChanged :
QMetaObject::activate :
QgsStyleGroupSelectionDialog::groupTreeSelectionChanged :
QMetaObject::activate :
QItemSelectionModel::select :
QItemSelectionModel::select :
QgsFeatureListView::ensureEditSelection :
QMetaObject::activate :
QMetaObject::activate :
QMetaObject::activate :
QMetaObject::activate :
QMetaObject::activate :
QMetaObject::activate :
QMetaObject::activate :
QgsVectorLayer::deleteAttribute :
QgsVectorLayer::deleteAttributes :
QgsAttributeTableDialog::mActionRemoveAttribute_triggered :
QMetaObject::activate :
QMetaObject::activate :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
SetDebugErrorLevel :
DispatchMessageW :
DispatchMessageW :
RtlAllocateHeap :
QCoreApplication::exec :
main :
RtlUnwind :
BaseThreadInitThunk :
EtwProcessPrivateLoggerRequest :
RtlCaptureContext :

QGIS Info
QGIS Version: 3.0.1-Girona
QGIS code revision: a86bec25eb
Compiled against Qt: 5.9.2
Running against Qt: 5.9.2
Compiled against GDAL: 2.2.4
Running against GDAL: 2.2.4

System Info
CPU Type: i386
Kernel Type: winnt
Kernel Version: 10.0.16299

History

#1 Updated by Nathan Perry over 6 years ago

Same issue here, QGIS 3.0.2 running in Mac OS 10.13.3. I have both the "too many attributes" error and the crash when deleting the virtual field.

#2 Updated by Antoine Lafranchis over 6 years ago

Steps to reproduce this issue in version 3.0.3:
  1. Create new project, without saving it
  2. Create temporary scratch layer with no geometry
  3. Add 6 new features
  4. Toggle edit mode off and save changes
  5. Open attribute table and field calculator
  6. Add virtual field with type integer, name test1 and expression 1
  7. Add virtual field with type integer, name test2 and expression 2
  8. Toggle edit mode on with the button in the attribute table
  9. Click the delete field button in the attribute table
  10. Select the two virtual fields and click OK

#3 Updated by Matthew Bodnar over 6 years ago

I have encountered this crash behavior on 3.03 when attempting to remove a virtual field from a layer table in a geopackage. I was able to remove one of 3 virtual fields, save edits and the crash was encountered upon trying to delete the seconf virtual field. There was no error statement prior to crash. Crash handler log below..

User Feedback

Report Details

Crash ID: 8e0869f8aec32a1249f046e346c6bf2b99f6cbd0

Stack Trace

QgsField::QgsField :
QgsFields::field :
QgsAttributeForm::updateJoinedFields :
QgsAttributeForm::onAttributeChanged :
QMetaObject::activate :
QgsEditorWidgetWrapper::valueChanged :
QgsEditorWidgetWrapper::emitValueChanged :
QMetaObject::activate :
QSpinBox::displayIntegerBase :
QAbstractSpinBox::setSpecialValueText :
QSpinBox::setValue :
QgsRangeWidgetWrapper::setValue :
QgsEditorWidgetWrapper::setFeature :
QgsAttributeForm::resetValues :
QgsAttributeForm::setFeature :
QgsDualView::mFeatureList_currentEditSelectionChanged :
QMetaObject::activate :
QgsFeatureListView::currentEditSelectionChanged :
QgsFeatureListView::editSelectionChanged :
QMetaObject::activate :
QItemSelectionModel::emitSelectionChanged :
QItemSelectionModel::select :
QItemSelectionModel::select :
QgsFeatureListView::ensureEditSelection :
QMetaObject::activate :
QAbstractItemModel::modelReset :
QMetaObject::activate :
QAbstractItemModel::endResetModel :
QSortFilterProxyModel::`default constructor closure' :
QMetaObject::activate :
QAbstractItemModel::endResetModel :
QgsAttributeTableModel::loadLayer :
QMetaObject::activate :
QMetaObject::activate :
QgsVectorLayer::updateFields :
QgsVectorLayer::deleteAttribute :
QgsVectorLayer::deleteAttributes :
QgsAttributeTableDialog::mActionRemoveAttribute_triggered :
QMetaObject::activate :
QAction::activate :
QAbstractButton::click :
QAbstractButton::mouseReleaseEvent :
QToolButton::mouseReleaseEvent :
QWidget::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
CallWindowProcW :
DispatchMessageW :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info
QGIS Version: 3.0.3-Girona
QGIS code revision: 8a899c8758
Compiled against Qt: 5.9.2
Running against Qt: 5.9.2
Compiled against GDAL: 2.2.4
Running against GDAL: 2.2.4

System Info
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.16299

#4 Updated by Matthew Bodnar over 6 years ago

Update...

I am able to remove only (1) virtual field per session. To delete more I must save edits and restart QGIS completely.

#5 Updated by Peter Petrik almost 6 years ago

this may be related to fixed #18954. Can you please retest with 3.5 master?

#6 Updated by Giovanni Manghi almost 6 years ago

  • Status changed from Open to Feedback
  • Priority changed from Normal to High

#7 Updated by Giovanni Manghi over 5 years ago

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

Peter Petrik wrote:

this may be related to fixed #18954. Can you please retest with 3.5 master?

seems really fixed, please reopen if necessary.

Also available in: Atom PDF