mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Inverted polygons: fix memory leaks
This commit is contained in:
parent
b2782ee7a1
commit
71a1f89e8d
@ -6402,16 +6402,18 @@ namespace QgsGeometryAlgorithms
|
||||
|
||||
QgsGeometry* unaryUnion( const QList<QgsGeometry*>& geometryList )
|
||||
{
|
||||
QList<GEOSGeometry*> geoms;
|
||||
QVector<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* geomCollection = 0;
|
||||
geomCollection = createGeosCollection( GEOS_GEOMETRYCOLLECTION, geoms );
|
||||
GEOSGeometry* geomUnion = GEOSUnaryUnion( geomCollection );
|
||||
GEOSGeom_destroy( geomCollection );
|
||||
QgsGeometry *ret = new QgsGeometry();
|
||||
ret->fromGeos( unioned );
|
||||
ret->fromGeos( geomUnion );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ void QgsInvertedPolygonRenderer::startRender( QgsRenderContext& context, const Q
|
||||
mSubRenderer->startRender( context, fields );
|
||||
|
||||
mFeaturesCategories.clear();
|
||||
mSymbolCategories.clear();
|
||||
mFeatureDecorations.clear();
|
||||
mFields = fields;
|
||||
|
||||
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user