Skip to content

Commit 603cff8

Browse files
author
jef
committed
fix #3001
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14228 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5334d37 commit 603cff8

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

src/core/qgsvectordataprovider.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,7 @@ QVariant QgsVectorDataProvider::minimumValue( int index )
305305
return QVariant();
306306
}
307307

308-
if ( mCacheMinMaxDirty )
309-
{
310-
fillMinMaxCache();
311-
}
308+
fillMinMaxCache();
312309

313310
if ( !mCacheMinValues.contains( index ) )
314311
return QVariant();
@@ -324,10 +321,7 @@ QVariant QgsVectorDataProvider::maximumValue( int index )
324321
return QVariant();
325322
}
326323

327-
if ( mCacheMinMaxDirty )
328-
{
329-
fillMinMaxCache();
330-
}
324+
fillMinMaxCache();
331325

332326
if ( !mCacheMaxValues.contains( index ) )
333327
return QVariant();
@@ -358,8 +352,16 @@ void QgsVectorDataProvider::uniqueValues( int index, QList<QVariant> &values, in
358352
}
359353
}
360354

355+
void QgsVectorDataProvider::clearMinMaxCache()
356+
{
357+
mCacheMinMaxDirty = true;
358+
}
359+
361360
void QgsVectorDataProvider::fillMinMaxCache()
362361
{
362+
if ( !mCacheMinMaxDirty )
363+
return;
364+
363365
const QgsFieldMap& flds = fields();
364366
for ( QgsFieldMap::const_iterator it = flds.begin(); it != flds.end(); ++it )
365367
{

src/core/qgsvectordataprovider.h

+1
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
356356
protected:
357357
QVariant convertValue( QVariant::Type type, QString value );
358358

359+
void clearMinMaxCache();
359360
void fillMinMaxCache();
360361

361362
bool mCacheMinMaxDirty;

src/providers/ogr/qgsogrprovider.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,9 @@ bool QgsOgrProvider::addFeatures( QgsFeatureList & flist )
843843
}
844844
recalculateFeatureCount();
845845

846+
if ( returnvalue )
847+
clearMinMaxCache();
848+
846849
return returnvalue;
847850
}
848851

@@ -888,6 +891,11 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
888891

889892
bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr_map )
890893
{
894+
if ( attr_map.isEmpty() )
895+
return true;
896+
897+
clearMinMaxCache();
898+
891899
for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
892900
{
893901
long fid = ( long ) it.key();
@@ -1049,6 +1057,8 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id )
10491057

10501058
recalculateFeatureCount();
10511059

1060+
clearMinMaxCache();
1061+
10521062
if ( extent_ )
10531063
{
10541064
free( extent_ );

0 commit comments

Comments
 (0)