Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f64d8e6

Browse files
nirvngithub-actions[bot]
authored andcommittedApr 27, 2021
Apply @nyalldawson 's suggestion
1 parent 09e822f commit f64d8e6

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed
 

‎src/analysis/vector/qgsgeometrysnapper.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "qgssurface.h"
2525
#include "qgsmultisurface.h"
2626
#include "qgscurve.h"
27-
#include "qgsgeos.h"
2827

2928
#include <QtConcurrentMap>
3029
#include <geos_c.h>
@@ -199,12 +198,7 @@ QgsSnapIndex::~QgsSnapIndex()
199198
qDeleteAll( mCoordIdxs );
200199
qDeleteAll( mSnapItems );
201200

202-
GEOSContextHandle_t geosctxt = QgsGeos::getGEOSHandler();
203-
for ( GEOSGeometry *geom : mSTRTreeItems )
204-
{
205-
GEOSGeom_destroy_r( geosctxt, geom );
206-
}
207-
GEOSSTRtree_destroy_r( geosctxt, mSTRTree );
201+
GEOSSTRtree_destroy_r( QgsGeos::getGEOSHandler(), mSTRTree );
208202
}
209203

210204
void QgsSnapIndex::addPoint( const CoordIdx *idx, bool isEndPoint )
@@ -226,7 +220,7 @@ void QgsSnapIndex::addPoint( const CoordIdx *idx, bool isEndPoint )
226220
PointSnapItem *item = new PointSnapItem( idx, isEndPoint );
227221
GEOSSTRtree_insert_r( geosctxt, mSTRTree, point.get(), item );
228222
#if GEOS_VERSION_MAJOR>3 || GEOS_VERSION_MINOR<9
229-
mSTRTreeItems << point.release();
223+
mSTRTreeItems.push_back( std::move( point ) );
230224
#endif
231225
mSnapItems << item;
232226
}
@@ -257,7 +251,7 @@ void QgsSnapIndex::addSegment( const CoordIdx *idxFrom, const CoordIdx *idxTo )
257251
SegmentSnapItem *item = new SegmentSnapItem( idxFrom, idxTo );
258252
GEOSSTRtree_insert_r( geosctxt, mSTRTree, point.get(), item );
259253
#if GEOS_VERSION_MAJOR>3 || GEOS_VERSION_MINOR<9
260-
mSTRTreeItems << point.release();
254+
mSTRTreeItems.push_back( std::move( point ) );
261255
#endif
262256
mSnapItems << item;
263257
}

‎src/analysis/vector/qgsgeometrysnapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "qgsabstractgeometry.h"
2222
#include "qgspoint.h"
2323
#include "qgsgeometry.h"
24+
#include "qgsgeos.h"
2425
#include "qgis_analysis.h"
2526

2627
#include <QMutex>
@@ -238,7 +239,7 @@ class QgsSnapIndex
238239
void addSegment( const CoordIdx *idxFrom, const CoordIdx *idxTo );
239240

240241
GEOSSTRtree *mSTRTree = nullptr;
241-
QList<GEOSGeometry *> mSTRTreeItems;
242+
std::vector< geos::unique_ptr > mSTRTreeItems;
242243
};
243244

244245
///@endcond

0 commit comments

Comments
 (0)
Please sign in to comment.