Skip to content

Commit

Permalink
Fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 29, 2015
1 parent 7267d01 commit 42da218
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
1 change: 1 addition & 0 deletions python/gui/attributetable/qgsfeaturemodel.sip
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ class QgsFeatureModel
#include <qgsfeaturemodel.h>
%End
public:
virtual ~QgsFeatureModel() {}
virtual QModelIndex fidToIndex( QgsFeatureId fid ) = 0;
};
3 changes: 1 addition & 2 deletions src/gui/attributetable/qgsfeaturemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
class QgsFeatureModel
{
public:
~ QgsFeatureModel()
{}
virtual ~QgsFeatureModel() {}

virtual QModelIndex fidToIndex( QgsFeatureId fid ) = 0;
};
Expand Down
36 changes: 30 additions & 6 deletions src/server/qgswfsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1697,9 +1697,17 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoord

fStr += " \"geometry\": ";
if ( mGeometryName == "EXTENT" )
fStr += QgsGeometry::fromRect( box )->exportToGeoJSON( prec );
{
QgsGeometry* bbox = QgsGeometry::fromRect( box );
fStr += bbox->exportToGeoJSON( prec );
delete bbox;
}
else if ( mGeometryName == "CENTROID" )
fStr += geom->centroid()->exportToGeoJSON( prec );
{
QgsGeometry* centroid = geom->centroid();
fStr += centroid->exportToGeoJSON( prec );
delete centroid;
}
else
fStr += geom->exportToGeoJSON( prec );
fStr += ",\n";
Expand Down Expand Up @@ -1766,9 +1774,17 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
QDomElement geomElem = doc.createElement( "qgs:geometry" );
QDomElement gmlElem;
if ( mGeometryName == "EXTENT" )
gmlElem = QgsOgcUtils::geometryToGML( QgsGeometry::fromRect( geom->boundingBox() ), doc, prec );
{
QgsGeometry* bbox = QgsGeometry::fromRect( geom->boundingBox() );
gmlElem = QgsOgcUtils::geometryToGML( bbox , doc, prec );
delete bbox;
}
else if ( mGeometryName == "CENTROID" )
gmlElem = QgsOgcUtils::geometryToGML( geom->centroid(), doc, prec );
{
QgsGeometry* centroid = geom->centroid();
gmlElem = QgsOgcUtils::geometryToGML( centroid, doc, prec );
delete centroid;
}
else
gmlElem = QgsOgcUtils::geometryToGML( geom, doc, prec );
if ( !gmlElem.isNull() )
Expand Down Expand Up @@ -1831,9 +1847,17 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
QDomElement geomElem = doc.createElement( "qgs:geometry" );
QDomElement gmlElem;
if ( mGeometryName == "EXTENT" )
gmlElem = QgsOgcUtils::geometryToGML( QgsGeometry::fromRect( geom->boundingBox() ), doc, "GML3", prec );
{
QgsGeometry* bbox = QgsGeometry::fromRect( geom->boundingBox() );
gmlElem = QgsOgcUtils::geometryToGML( bbox, doc, "GML3", prec );
delete bbox;
}
else if ( mGeometryName == "CENTROID" )
gmlElem = QgsOgcUtils::geometryToGML( geom->centroid(), doc, "GML3", prec );
{
QgsGeometry* centroid = geom->centroid();
gmlElem = QgsOgcUtils::geometryToGML( centroid, doc, "GML3", prec );
delete centroid;
}
else
gmlElem = QgsOgcUtils::geometryToGML( geom, doc, "GML3", prec );
if ( !gmlElem.isNull() )
Expand Down

0 comments on commit 42da218

Please sign in to comment.