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 396a135
Showing 1 changed file with 12 additions and 3 deletions.
@@ -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.