Skip to content
Permalink
Browse files

QgsOgrProvider::deleteFeatures(): restore previous (odd) behaviour re…

…garding shapefiles and feature count
  • Loading branch information
rouault authored and nyalldawson committed Oct 17, 2020
1 parent 87f0b2b commit 4cf40fb32f3c82a245a05ebbf94a9a1ce691322f
Showing with 14 additions and 6 deletions.
  1. +14 −6 src/core/providers/ogr/qgsogrprovider.cpp
@@ -2709,13 +2709,21 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds &id )
returnvalue = false;
}

if ( mFeaturesCounted != QgsVectorDataProvider::Uncounted &&
mFeaturesCounted != QgsVectorDataProvider::UnknownCount )
if ( mGDALDriverName == QLatin1String( "ESRI Shapefile" ) )
{
if ( returnvalue )
mFeaturesCounted -= id.size();
else
recalculateFeatureCount();
// Shapefile behaves in a special way due to possible recompaction
recalculateFeatureCount();
}
else
{
if ( mFeaturesCounted != QgsVectorDataProvider::Uncounted &&
mFeaturesCounted != QgsVectorDataProvider::UnknownCount )
{
if ( returnvalue )
mFeaturesCounted -= id.size();
else
recalculateFeatureCount();
}
}

clearMinMaxCache();

0 comments on commit 4cf40fb

Please sign in to comment.
You can’t perform that action at this time.