mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
Don't delete locator while indexing
This commit is contained in:
parent
d0e26fb3bc
commit
95a100bcc4
@ -548,6 +548,10 @@ QgsPointLocator::QgsPointLocator( QgsVectorLayer *layer, const QgsCoordinateRefe
|
||||
|
||||
QgsPointLocator::~QgsPointLocator()
|
||||
{
|
||||
// don't delete a locator if there is an indexing task running on it
|
||||
if ( mIsIndexing )
|
||||
waitForIndexingFinished();
|
||||
|
||||
destroyIndex();
|
||||
}
|
||||
|
||||
|
@ -464,6 +464,16 @@ class TestQgsPointLocator : public QObject
|
||||
QCOMPARE( m.vertexIndex(), 2 );
|
||||
}
|
||||
|
||||
void testDeleteLocator()
|
||||
{
|
||||
QgsPointLocator *loc = new QgsPointLocator( mVL, QgsCoordinateReferenceSystem(), QgsCoordinateTransformContext(), nullptr );
|
||||
QgsPointXY pt( 2, 2 );
|
||||
|
||||
// delete locator while we are indexing (could happend when closing project for instance)
|
||||
loc->nearestVertex( pt, 999, nullptr, true );
|
||||
delete loc;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QGSTEST_MAIN( TestQgsPointLocator )
|
||||
|
Loading…
x
Reference in New Issue
Block a user