Skip to content

Commit

Permalink
RAII for pal
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 10, 2019
1 parent 7ceb97a commit 9de4b88
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/pal/layer.cpp
Expand Up @@ -118,7 +118,7 @@ bool Layer::registerFeature( QgsLabelFeature *lf )
std::unique_ptr<FeaturePart> biggest_part;

// break the (possibly multi-part) geometry into simple geometries
QLinkedList<const GEOSGeometry *> *simpleGeometries = Util::unmulti( lf->geometry() );
std::unique_ptr<QLinkedList<const GEOSGeometry *>> simpleGeometries( Util::unmulti( lf->geometry() ) );
if ( !simpleGeometries ) // unmulti() failed?
{
throw InternalException::UnknownGeometry();
Expand Down Expand Up @@ -203,12 +203,11 @@ bool Layer::registerFeature( QgsLabelFeature *lf )
addFeaturePart( fpart.release(), lf->labelText() );
addedFeature = true;
}
delete simpleGeometries;

if ( !featureGeomIsObstacleGeom )
{
//do the same for the obstacle geometry
simpleGeometries = Util::unmulti( lf->obstacleGeometry() );
simpleGeometries.reset( Util::unmulti( lf->obstacleGeometry() ) );
if ( !simpleGeometries ) // unmulti() failed?
{
throw InternalException::UnknownGeometry();
Expand Down Expand Up @@ -249,7 +248,6 @@ bool Layer::registerFeature( QgsLabelFeature *lf )
// feature part is ready!
addObstaclePart( fpart.release() );
}
delete simpleGeometries;
}

locker.unlock();
Expand Down

0 comments on commit 9de4b88

Please sign in to comment.