Skip to content

Commit

Permalink
Merge pull request #39548 from 3nids/fix-duplicate-errors
Browse files Browse the repository at this point in the history
Fix duplicating features
  • Loading branch information
3nids committed Oct 22, 2020
2 parents f749089 + ffbe377 commit f5c8739
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayerutils.cpp
Expand Up @@ -635,6 +635,7 @@ QgsFeature QgsVectorLayerUtils::duplicateFeature( QgsVectorLayer *layer, const Q
context.setFeature( feature );

QgsFeature newFeature = createFeature( layer, feature.geometry(), feature.attributes().toMap(), &context );
layer->addFeature( newFeature );

const QList<QgsRelation> relations = project->relationManager()->referencedRelations( layer );

Expand Down Expand Up @@ -667,7 +668,6 @@ QgsFeature QgsVectorLayerUtils::duplicateFeature( QgsVectorLayer *layer, const Q
}
}

layer->addFeature( newFeature );

return newFeature;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -864,7 +864,7 @@ void QgsAttributeTableModel::executeMapLayerAction( QgsMapLayerAction *action, c

QgsFeature QgsAttributeTableModel::feature( const QModelIndex &idx ) const
{
QgsFeature f;
QgsFeature f( mLayerCache->layer()->fields() );
f.initAttributes( mAttributes.size() );
f.setId( rowToId( idx.row() ) );
for ( int i = 0; i < mAttributes.size(); i++ )
Expand Down

0 comments on commit f5c8739

Please sign in to comment.