Skip to content

Commit c55196c

Browse files
committed
Refresh feature after update
1 parent 3557228 commit c55196c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/analysis/vector/geometry_checker/qgsfeaturepool.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,15 @@ void QgsFeaturePool::insertFeature( const QgsFeature &feature )
8989
mIndex.insertFeature( feature );
9090
}
9191

92-
void QgsFeaturePool::changeFeature( const QgsFeature &feature )
92+
void QgsFeaturePool::refreshCache( const QgsFeature &feature )
9393
{
9494
QgsReadWriteLocker locker( mIndexLock, QgsReadWriteLocker::Write );
9595
mFeatureCache.remove( feature.id() );
96-
mFeatureCache.insert( feature.id(), new QgsFeature( feature ) );
9796
mIndex.deleteFeature( feature );
98-
mIndex.insertFeature( feature );
97+
locker.unlock();
98+
99+
QgsFeature tempFeature;
100+
get( feature.id(), tempFeature );
99101
}
100102

101103
void QgsFeaturePool::removeFeature( const QgsFeatureId featureId )

src/analysis/vector/geometry_checker/qgsfeaturepool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class ANALYSIS_EXPORT QgsFeaturePool
117117
* Changes a feature in the cache and the spatial index.
118118
* To be used by implementations of ``updateFeature``.
119119
*/
120-
void changeFeature( const QgsFeature &feature );
120+
void refreshCache( const QgsFeature &feature );
121121

122122
/**
123123
* Removes a feature from the cache and the spatial index.

src/analysis/vector/geometry_checker/qgsvectordataproviderfeaturepool.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ void QgsVectorDataProviderFeaturePool::updateFeature( QgsFeature &feature )
110110
}
111111
changedAttributesMap.insert( feature.id(), attribMap );
112112

113-
removeFeature( origFeature.id() );
114113
runOnMainThread( [this, geometryMap, changedAttributesMap]()
115114
{
116115
QgsVectorLayer *lyr = layer();
@@ -121,7 +120,7 @@ void QgsVectorDataProviderFeaturePool::updateFeature( QgsFeature &feature )
121120
}
122121
} );
123122

124-
insertFeature( feature );
123+
refreshCache( feature );
125124
}
126125

127126
void QgsVectorDataProviderFeaturePool::deleteFeature( QgsFeatureId fid )

0 commit comments

Comments
 (0)