Skip to content
Permalink
Browse files

Fix leaks in QgsPointLocator

  • Loading branch information
nyalldawson committed Aug 26, 2015
1 parent a417dcf commit c9a00552298f16f7632cffaa19f86ebdfc15c5f9
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/core/qgspointlocator.cpp
@@ -670,6 +670,9 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )

SpatialIndex::Region r( rect2region( f.constGeometry()->boundingBox() ) );
dataList << new RTree::Data( 0, 0, r, f.id() );

if ( mGeoms.contains( f.id() ) )
delete mGeoms.take( f.id() );
mGeoms[f.id()] = new QgsGeometry( *f.constGeometry() );
++indexedCount;

@@ -748,6 +751,9 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
{
SpatialIndex::Region r( rect2region( bbox ) );
mRTree->insertData( 0, 0, r, f.id() );

if ( mGeoms.contains( f.id() ) )
delete mGeoms.take( f.id() );
mGeoms[fid] = new QgsGeometry( *f.constGeometry() );
}
}
@@ -761,7 +767,7 @@ void QgsPointLocator::onFeatureDeleted( QgsFeatureId fid )
if ( mGeoms.contains( fid ) )
{
mRTree->deleteData( rect2region( mGeoms[fid]->boundingBox() ), fid );
mGeoms.remove( fid );
delete mGeoms.take( fid );
}
}

0 comments on commit c9a0055

Please sign in to comment.
You can’t perform that action at this time.