Skip to content
Permalink
Browse files

Merge pull request #8331 from rldhont/fix-server-wfs-force-multi-geom…

…-gml-218

[Bugfix][Server][WFS] Segfault when converting geom to multi
  • Loading branch information
rldhont committed Oct 26, 2018
2 parents 75a170d + 81f4bdb commit daa650edf9c50daa611d70095a37c5d95c1244f7
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/server/qgswfsserver.cpp
@@ -2070,12 +2070,11 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
typeNameElement.setAttribute( "fid", mTypeName + "." + gmlId );
featureElement.appendChild( typeNameElement );

const QgsGeometry* geom = feat->constGeometry();
const QgsGeometry* cGeom = feat->constGeometry();
QgsGeometry *geom = new QgsGeometry( *cGeom );
if ( isMultiGeom && QgsWKBTypes::isSingleType( QGis::fromOldWkbType( geom->wkbType() ) ) )
{
QgsGeometry cloneGeom( *geom );
cloneGeom.convertToMultiType();
geom = &cloneGeom;
geom->convertToMultiType();
}
if ( geom && mWithGeom && mGeometryName != "NONE" )
{
@@ -2121,6 +2120,7 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
typeNameElement.appendChild( geomElem );
}
}
delete geom;

//read all attribute values from the feature
QgsAttributes featureAttributes = feat->attributes();
@@ -2160,12 +2160,12 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
typeNameElement.setAttribute( "gml:id", mTypeName + "." + gmlId );
featureElement.appendChild( typeNameElement );

const QgsGeometry* geom = feat->constGeometry();

const QgsGeometry* cGeom = feat->constGeometry();
QgsGeometry *geom = new QgsGeometry( *cGeom );
if ( isMultiGeom && QgsWKBTypes::isSingleType( QGis::fromOldWkbType( geom->wkbType() ) ) )
{
QgsGeometry cloneGeom( *geom );
cloneGeom.convertToMultiType();
geom = &cloneGeom;
geom->convertToMultiType();
}
if ( geom && mWithGeom && mGeometryName != "NONE" )
{
@@ -2211,6 +2211,7 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
typeNameElement.appendChild( geomElem );
}
}
delete geom;

//read all attribute values from the feature
QgsAttributes featureAttributes = feat->attributes();

0 comments on commit daa650e

Please sign in to comment.
You can’t perform that action at this time.