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 )
670
670
671
671
SpatialIndex::Region r ( rect2region ( f.constGeometry ()->boundingBox () ) );
672
672
dataList << new RTree::Data ( 0 , 0 , r, f.id () );
673
+
674
+ if ( mGeoms .contains ( f.id () ) )
675
+ delete mGeoms .take ( f.id () );
673
676
mGeoms [f.id ()] = new QgsGeometry ( *f.constGeometry () );
674
677
++indexedCount;
675
678
@@ -748,6 +751,9 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
748
751
{
749
752
SpatialIndex::Region r ( rect2region ( bbox ) );
750
753
mRTree ->insertData ( 0 , 0 , r, f.id () );
754
+
755
+ if ( mGeoms .contains ( f.id () ) )
756
+ delete mGeoms .take ( f.id () );
751
757
mGeoms [fid] = new QgsGeometry ( *f.constGeometry () );
752
758
}
753
759
}
@@ -761,7 +767,7 @@ void QgsPointLocator::onFeatureDeleted( QgsFeatureId fid )
761
767
if ( mGeoms .contains ( fid ) )
762
768
{
763
769
mRTree ->deleteData ( rect2region ( mGeoms [fid]->boundingBox () ), fid );
764
- mGeoms .remove ( fid );
770
+ delete mGeoms .take ( fid );
765
771
}
766
772
}
767
773
You can’t perform that action at this time.
0 commit comments