Skip to content
Permalink
Browse files

Don't crash when deleting last vertex

Fix #12867

Also preserves NULL rectangles in QgsRectangle::normalize()
  • Loading branch information
m-kuhn committed Jun 4, 2015
1 parent 385529e commit 033baf1b0cb266d2960f3017b30a57e89ab4e0e4
Showing with 12 additions and 5 deletions.
  1. +9 −5 src/core/qgspointlocator.cpp
  2. +3 −0 src/core/qgsrectangle.cpp
@@ -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 );

0 comments on commit 033baf1

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