@@ -621,8 +621,7 @@ class QgsPointLocator_DumpTree : public SpatialIndex::IQueryStrategy
621
621
622
622
623
623
QgsPointLocator::QgsPointLocator ( QgsVectorLayer *layer, const QgsCoordinateReferenceSystem &destCRS, const QgsCoordinateTransformContext &transformContext, const QgsRectangle *extent )
624
- : mIsEmptyLayer( false )
625
- , mLayer( layer )
624
+ : mLayer( layer )
626
625
{
627
626
if ( destCRS.isValid () )
628
627
{
@@ -631,7 +630,7 @@ QgsPointLocator::QgsPointLocator( QgsVectorLayer *layer, const QgsCoordinateRefe
631
630
632
631
setExtent ( extent );
633
632
634
- mStorage = StorageManager::createNewMemoryStorageManager ();
633
+ mStorage . reset ( StorageManager::createNewMemoryStorageManager () );
635
634
636
635
connect ( mLayer , &QgsVectorLayer::featureAdded, this , &QgsPointLocator::onFeatureAdded );
637
636
connect ( mLayer , &QgsVectorLayer::featureDeleted, this , &QgsPointLocator::onFeatureDeleted );
@@ -644,8 +643,6 @@ QgsPointLocator::QgsPointLocator( QgsVectorLayer *layer, const QgsCoordinateRefe
644
643
QgsPointLocator::~QgsPointLocator ()
645
644
{
646
645
destroyIndex ();
647
- delete mStorage ;
648
- delete mExtent ;
649
646
}
650
647
651
648
QgsCoordinateReferenceSystem QgsPointLocator::destinationCrs () const
@@ -655,10 +652,7 @@ QgsCoordinateReferenceSystem QgsPointLocator::destinationCrs() const
655
652
656
653
void QgsPointLocator::setExtent ( const QgsRectangle *extent )
657
654
{
658
- if ( extent )
659
- {
660
- mExtent = new QgsRectangle ( *extent );
661
- }
655
+ mExtent .reset ( extent ? new QgsRectangle ( *extent ) : nullptr );
662
656
663
657
destroyIndex ();
664
658
}
@@ -803,8 +797,8 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
803
797
}
804
798
805
799
QgsPointLocator_Stream stream ( dataList );
806
- mRTree = RTree::createAndBulkLoadNewRTree ( RTree::BLM_STR, stream, *mStorage , fillFactor, indexCapacity,
807
- leafCapacity, dimension, variant, indexId );
800
+ mRTree . reset ( RTree::createAndBulkLoadNewRTree ( RTree::BLM_STR, stream, *mStorage , fillFactor, indexCapacity,
801
+ leafCapacity, dimension, variant, indexId ) );
808
802
809
803
if ( ctx && renderer )
810
804
{
@@ -816,8 +810,7 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
816
810
817
811
void QgsPointLocator::destroyIndex ()
818
812
{
819
- delete mRTree ;
820
- mRTree = nullptr ;
813
+ mRTree .reset ();
821
814
822
815
mIsEmptyLayer = false ;
823
816
0 commit comments