Skip to content
Permalink
Browse files

Fix crash in test

  • Loading branch information
m-kuhn committed Aug 14, 2017
1 parent 0683528 commit cb29b2e6ef5aa656bc6e182daf8a101442b76023
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/core/geometry/qgsgeometryeditutils.cpp
@@ -120,9 +120,7 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addPart( QgsAbstractGeometry
if ( QgsWkbTypes::flatType( geom->wkbType() ) == QgsWkbTypes::MultiSurface
|| QgsWkbTypes::flatType( geom->wkbType() ) == QgsWkbTypes::MultiPolygon )
{
std::unique_ptr<QgsCurve> curve( qgsgeometry_cast<QgsCurve *>( part.get() ) );
if ( curve )
part.release();
QgsCurve *curve = qgsgeometry_cast<QgsCurve *>( part.get() );

if ( curve && curve->isClosed() && curve->numPoints() >= 4 )
{
@@ -135,7 +133,10 @@ QgsGeometry::OperationResult QgsGeometryEditUtils::addPart( QgsAbstractGeometry
{
poly.reset( new QgsCurvePolygon() );
}
poly->setExteriorRing( curve.release() );
// Ownership is still with part, curve points to the same object and is transferred
// to poly here.
part.release();
poly->setExteriorRing( curve );
added = geomCollection->addGeometry( poly.release() );
}
else if ( QgsWkbTypes::flatType( part->wkbType() ) == QgsWkbTypes::Polygon )

0 comments on commit cb29b2e

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