mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Don't crash when deleting last vertex
Fix #12867 Also preserves NULL rectangles in QgsRectangle::normalize()
This commit is contained in:
parent
385529ef7b
commit
033baf1b0c
@ -709,8 +709,8 @@ void QgsPointLocator::destroyIndex()
|
||||
|
||||
mIsEmptyLayer = false;
|
||||
|
||||
foreach ( QgsGeometry* g, mGeoms )
|
||||
delete g;
|
||||
qDeleteAll( mGeoms );
|
||||
|
||||
mGeoms.clear();
|
||||
}
|
||||
|
||||
@ -743,9 +743,13 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
|
||||
}
|
||||
}
|
||||
|
||||
SpatialIndex::Region r( rect2region( f.constGeometry()->boundingBox() ) );
|
||||
mRTree->insertData( 0, 0, r, f.id() );
|
||||
mGeoms[fid] = new QgsGeometry( *f.constGeometry() );
|
||||
QgsRectangle bbox = f.constGeometry()->boundingBox();
|
||||
if ( !bbox.isNull() )
|
||||
{
|
||||
SpatialIndex::Region r( rect2region( bbox ) );
|
||||
mRTree->insertData( 0, 0, r, f.id() );
|
||||
mGeoms[fid] = new QgsGeometry( *f.constGeometry() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,9 @@ void QgsRectangle::set( double xmin_, double ymin_, double xmax_, double ymax_ )
|
||||
|
||||
void QgsRectangle::normalize()
|
||||
{
|
||||
if ( isNull() )
|
||||
return;
|
||||
|
||||
if ( xmin > xmax )
|
||||
{
|
||||
std::swap( xmin, xmax );
|
||||
|
Loading…
x
Reference in New Issue
Block a user