Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix some leaks in labeling (many left)
  • Loading branch information
nyalldawson committed Aug 26, 2015
1 parent 02cd767 commit 36675ba
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/core/pal/feature.cpp
Expand Up @@ -110,6 +110,7 @@ namespace pal
{
mHoles.at( i )->holeOf = this;
}

}


Expand All @@ -119,7 +120,6 @@ namespace pal

qDeleteAll( mHoles );
mHoles.clear();

}

void FeaturePart::extractCoords( const GEOSGeometry* geom )
Expand Down Expand Up @@ -166,6 +166,7 @@ namespace pal
xmax = ymax = -DBL_MAX;

// initialize coordinate arrays
deleteCoords();
x = new double[nbPoints];
y = new double[nbPoints];

Expand Down
2 changes: 0 additions & 2 deletions src/core/pal/labelposition.cpp
Expand Up @@ -175,8 +175,6 @@ namespace pal
probFeat = other.probFeat;
nbOverlap = other.nbOverlap;

memcpy( x, other.x, sizeof( double )*4 );
memcpy( y, other.y, sizeof( double )*4 );
alpha = other.alpha;
w = other.w;
h = other.h;
Expand Down
5 changes: 5 additions & 0 deletions src/core/pal/layer.cpp
Expand Up @@ -235,6 +235,10 @@ namespace pal
delete biggest_part; // safe with NULL part
biggest_part = fpart;
}
else
{
delete fpart;
}
continue; // don't add the feature part now, do it later
// TODO: we should probably add also other parts to act just as obstacles
}
Expand Down Expand Up @@ -463,6 +467,7 @@ namespace pal
newFeatureParts->append( newfpart );
newfpart->getBoundingBox( bmin, bmax );
rtree->Insert( bmin, bmax, newfpart );
delete fpart;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/core/pal/layer.h
Expand Up @@ -330,6 +330,7 @@ namespace pal

/** Add newly created feature part into r tree and to the list */
void addFeaturePart( FeaturePart* fpart, const QString &labelText = QString() );

};

} // end namespace pal
Expand Down
2 changes: 2 additions & 0 deletions src/core/pal/pal.cpp
Expand Up @@ -386,6 +386,7 @@ namespace pal

if ( isCancelled() )
{
qDeleteAll( *fFeats );
delete fFeats;
delete prob;
delete obstacles;
Expand Down Expand Up @@ -464,6 +465,7 @@ namespace pal
{
if ( isCancelled() )
{
qDeleteAll( *fFeats );
delete fFeats;
delete prob;
delete obstacles;
Expand Down
8 changes: 2 additions & 6 deletions src/core/pal/pointset.cpp
Expand Up @@ -126,12 +126,8 @@ namespace pal
nbPoints = ps.nbPoints;
x = new double[nbPoints];
y = new double[nbPoints];

for ( i = 0; i < nbPoints; i++ )
{
x[i] = ps.x[i];
y[i] = ps.y[i];
}
memcpy( x, ps.x, sizeof( double )* nbPoints );
memcpy( y, ps.y, sizeof( double )* nbPoints );

if ( ps.cHull )
{
Expand Down
1 change: 1 addition & 0 deletions src/core/qgspallabeling.cpp
Expand Up @@ -4227,6 +4227,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
if ( context.renderingStopped() )
{
delete problem;
deleteTemporaryData();
return; // it has been cancelled
}

Expand Down

0 comments on commit 36675ba

Please sign in to comment.