[Geometry checker] Fix possible use of deleted geometry

This commit is contained in:
Sandro Mani 2016-12-01 16:24:02 +01:00
parent 1ce2a102bb
commit 3bd8a29ad5

View File

@ -87,7 +87,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError*>& errors,
// For each gap polygon which does not lie on the boundary, get neighboring polygons and add error // For each gap polygon which does not lie on the boundary, get neighboring polygons and add error
for ( int iPart = 0, nParts = diffGeom->partCount(); iPart < nParts; ++iPart ) for ( int iPart = 0, nParts = diffGeom->partCount(); iPart < nParts; ++iPart )
{ {
QgsAbstractGeometry* geom = QgsGeometryCheckerUtils::getGeomPart( diffGeom, iPart ); QgsAbstractGeometry* geom = QgsGeometryCheckerUtils::getGeomPart( diffGeom, iPart )->clone();
// Skip the gap between features and boundingbox // Skip the gap between features and boundingbox
if ( geom->boundingBox() == envelope->boundingBox() ) if ( geom->boundingBox() == envelope->boundingBox() )
{ {
@ -127,7 +127,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError*>& errors,
} }
// Add error // Add error
errors.append( new QgsGeometryGapCheckError( this, geom->clone(), neighboringIds, geom->area(), gapAreaBBox ) ); errors.append( new QgsGeometryGapCheckError( this, geom, neighboringIds, geom->area(), gapAreaBBox ) );
} }
delete unionGeom; delete unionGeom;