Skip to content

Commit

Permalink
Merge pull request #1455 from Oslandia/fix_inverted
Browse files Browse the repository at this point in the history
Inverted polygons: fix memory leaks
  • Loading branch information
wonder-sk committed Jun 16, 2014
2 parents 8005eab + 1613d84 commit 7ed87c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6420,12 +6420,10 @@ QgsGeometry *QgsGeometry::unaryUnion( const QList<QgsGeometry*> &geometryList )
QList<GEOSGeometry*> geoms;
foreach( QgsGeometry* g, geometryList )
{
// const cast: it is ok here, since the pointers will only be used to be stored
// in a list for a call to union
geoms.append( const_cast<GEOSGeometry*>(g->asGeos()) );
geoms.append( GEOSGeom_clone(g->asGeos()) );
}
GEOSGeometry* unioned = _makeUnion( geoms );
GEOSGeometry *geomUnion = _makeUnion( geoms );
QgsGeometry *ret = new QgsGeometry();
ret->fromGeos( unioned );
ret->fromGeos( geomUnion );
return ret;
}
8 changes: 8 additions & 0 deletions src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void QgsInvertedPolygonRenderer::startRender( QgsRenderContext& context, const Q
mSubRenderer->startRender( context, fields );

mFeaturesCategories.clear();
mSymbolCategories.clear();
mFeatureDecorations.clear();
mFields = fields;

Expand Down Expand Up @@ -279,6 +280,13 @@ void QgsInvertedPolygonRenderer::stopRender( QgsRenderContext& context )
}
mSubRenderer->renderFeature( feat, mContext );
}
for ( FeatureCategoryVector::iterator cit = mFeaturesCategories.begin(); cit != mFeaturesCategories.end(); ++cit )
{
foreach( QgsGeometry* g, cit->geometries )
{
delete g;
}
}

// when no features are visible, we still have to draw the exterior rectangle
// warning: when sub renderers have more than one possible symbols,
Expand Down
2 changes: 2 additions & 0 deletions src/gui/symbology-ng/qgssinglesymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ QgsSingleSymbolRendererV2Widget::~QgsSingleSymbolRendererV2Widget()
delete mRenderer;

delete mSelector;

delete mDataDefinedMenus;
}


Expand Down

0 comments on commit 7ed87c6

Please sign in to comment.