Skip to content
Permalink
Browse files
Merge pull request #4540 from boundlessgeo/attributetable-fixes-16492…
…-backport

[bugfix] Attribute table crashes QGIS when deleting selected
  • Loading branch information
elpaso committed May 12, 2017
2 parents 477d1bd + 2b6b495 commit 396a135ca871b7632b9b4af55d2ce48c81c1db0b
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/gui/attributetable/qgsattributetabledelegate.cpp
@@ -98,9 +98,18 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode

if (( oldValue != newValue && newValue.isValid() ) || oldValue.isNull() != newValue.isNull() )
{
vl->beginEditCommand( tr( "Attribute changed" ) );
vl->changeAttributeValue( fid, fieldIdx, newValue, oldValue );
vl->endEditCommand();
// This fixes https://issues.qgis.org/issues/16492
QgsFeatureRequest request( fid );
request.setFlags( QgsFeatureRequest::NoGeometry );
request.setSubsetOfAttributes( QgsAttributeList( ) );
QgsFeature feature;
vl->getFeatures( request ).nextFeature( feature );
if ( feature.isValid( ) )
{
vl->beginEditCommand( tr( "Attribute changed" ) );
vl->changeAttributeValue( fid, fieldIdx, newValue, oldValue );
vl->endEditCommand();
}
}
}

0 comments on commit 396a135

Please sign in to comment.