Skip to content

Commit

Permalink
QgsOgrProvider::deleteFeatures(): restore previous (odd) behaviour re…
Browse files Browse the repository at this point in the history
…garding shapefiles and feature count
  • Loading branch information
rouault authored and nyalldawson committed Oct 17, 2020
1 parent 87f0b2b commit 4cf40fb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/core/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 4cf40fb

Please sign in to comment.