Skip to content

Commit c9a0055

Browse files
committedAug 26, 2015
Fix leaks in QgsPointLocator
1 parent a417dcf commit c9a0055

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎src/core/qgspointlocator.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)
Please sign in to comment.