File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -670,6 +670,9 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
670670
671671 SpatialIndex::Region r ( rect2region ( f.constGeometry ()->boundingBox () ) );
672672 dataList << new RTree::Data ( 0 , 0 , r, f.id () );
673+
674+ if ( mGeoms .contains ( f.id () ) )
675+ delete mGeoms .take ( f.id () );
673676 mGeoms [f.id ()] = new QgsGeometry ( *f.constGeometry () );
674677 ++indexedCount;
675678
@@ -748,6 +751,9 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
748751 {
749752 SpatialIndex::Region r ( rect2region ( bbox ) );
750753 mRTree ->insertData ( 0 , 0 , r, f.id () );
754+
755+ if ( mGeoms .contains ( f.id () ) )
756+ delete mGeoms .take ( f.id () );
751757 mGeoms [fid] = new QgsGeometry ( *f.constGeometry () );
752758 }
753759 }
@@ -761,7 +767,7 @@ void QgsPointLocator::onFeatureDeleted( QgsFeatureId fid )
761767 if ( mGeoms .contains ( fid ) )
762768 {
763769 mRTree ->deleteData ( rect2region ( mGeoms [fid]->boundingBox () ), fid );
764- mGeoms .remove ( fid );
770+ delete mGeoms .take ( fid );
765771 }
766772}
767773
You can’t perform that action at this time.
0 commit comments