Skip to content

Commit b934830

Browse files
committedMay 14, 2020
use reference for fids in deleteFeatures and ensure that they exist until the end in qgsrelationeditorwidget
1 parent 66a5dbf commit b934830

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed
 

‎python/core/auto_generated/qgsvectorlayer.sip.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,7 @@ Deletes a feature from the layer (but does not commit it).
19741974
changes can be discarded by calling rollBack().
19751975
%End
19761976

1977-
bool deleteFeatures( const QgsFeatureIds fids, DeleteContext *context = 0 );
1977+
bool deleteFeatures( const QgsFeatureIds &fids, DeleteContext *context = 0 );
19781978
%Docstring
19791979
Deletes a set of features from the layer (but does not commit it)
19801980

‎src/core/qgsvectorlayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3240,7 +3240,7 @@ bool QgsVectorLayer::deleteFeature( QgsFeatureId fid, QgsVectorLayer::DeleteCont
32403240
return res;
32413241
}
32423242

3243-
bool QgsVectorLayer::deleteFeatures( const QgsFeatureIds fids, QgsVectorLayer::DeleteContext *context )
3243+
bool QgsVectorLayer::deleteFeatures( const QgsFeatureIds &fids, QgsVectorLayer::DeleteContext *context )
32443244
{
32453245
bool res = true;
32463246
const auto constFids = fids;

‎src/core/qgsvectorlayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
18581858
* to the underlying data provider until a commitChanges() call is made. Any uncommitted
18591859
* changes can be discarded by calling rollBack().
18601860
*/
1861-
bool deleteFeatures( const QgsFeatureIds fids, DeleteContext *context = nullptr );
1861+
bool deleteFeatures( const QgsFeatureIds &fids, DeleteContext *context = nullptr );
18621862

18631863
/**
18641864
* Attempts to commit to the underlying data provider any buffered changes made since the

‎src/gui/qgsrelationeditorwidget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,8 @@ void QgsRelationEditorWidget::deleteFeature( const QgsFeatureId featureid )
652652

653653
void QgsRelationEditorWidget::deleteSelectedFeatures()
654654
{
655-
deleteFeatures( mFeatureSelectionMgr->selectedFeatureIds() );
655+
QgsFeatureIds selectedFids = mFeatureSelectionMgr->selectedFeatureIds();
656+
deleteFeatures( selectedFids );
656657
}
657658

658659
void QgsRelationEditorWidget::deleteFeatures( const QgsFeatureIds &featureids )

0 commit comments

Comments
 (0)
Please sign in to comment.