Skip to content

Commit

Permalink
Better memory management
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 25, 2019
1 parent b194f02 commit 7f68020
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/pal/layer.cpp
Expand Up @@ -380,7 +380,7 @@ void Layer::chopFeaturesAtRepeatDistance()
QLinkedList<FeaturePart *> newFeatureParts;
while ( !mFeatureParts.isEmpty() )
{
FeaturePart *fpart = mFeatureParts.takeFirst();
std::unique_ptr< FeaturePart > fpart( mFeatureParts.takeFirst() );
const GEOSGeometry *geom = fpart->geos();
double chopInterval = fpart->repeatDistance();
if ( chopInterval != 0. && GEOSGeomTypeId_r( geosctxt, geom ) == GEOS_LINESTRING )
Expand All @@ -389,7 +389,7 @@ void Layer::chopFeaturesAtRepeatDistance()

double bmin[2], bmax[2];
fpart->getBoundingBox( bmin, bmax );
mFeatureIndex->Remove( bmin, bmax, fpart );
mFeatureIndex->Remove( bmin, bmax, fpart.get() );

const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq_r( geosctxt, geom );

Expand Down Expand Up @@ -462,11 +462,10 @@ void Layer::chopFeaturesAtRepeatDistance()
newFeatureParts.append( newfpart );
newfpart->getBoundingBox( bmin, bmax );
mFeatureIndex->Insert( bmin, bmax, newfpart );
delete fpart;
}
else
{
newFeatureParts.append( fpart );
newFeatureParts.append( fpart.release() );
}
}

Expand Down

0 comments on commit 7f68020

Please sign in to comment.