Skip to content

Commit

Permalink
Add unique_ptr in nodeSpatialOperatorFromOgcFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Sep 13, 2018
1 parent 0d1da7d commit 180d6b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/qgsogcutils.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3265,7 +3265,7 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeSpatialOperatorF
// we are exploiting the fact that our function names are the same as the XML tag names // we are exploiting the fact that our function names are the same as the XML tag names
int opIdx = QgsExpression::functionIndex( element.tagName().toLower() ); int opIdx = QgsExpression::functionIndex( element.tagName().toLower() );


QgsExpressionNode::NodeList *gml2Args = new QgsExpressionNode::NodeList(); std::unique_ptr<QgsExpressionNode::NodeList> gml2Args( new QgsExpressionNode::NodeList() );
QDomElement childElem = element.firstChildElement(); QDomElement childElem = element.firstChildElement();
QString gml2Str; QString gml2Str;
while ( !childElem.isNull() && gml2Str.isEmpty() ) while ( !childElem.isNull() && gml2Str.isEmpty() )
Expand All @@ -3284,13 +3284,12 @@ QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeSpatialOperatorF
else else
{ {
mErrorMessage = QObject::tr( "No OGC Geometry found" ); mErrorMessage = QObject::tr( "No OGC Geometry found" );
delete gml2Args;
return nullptr; return nullptr;
} }


QgsExpressionNode::NodeList *opArgs = new QgsExpressionNode::NodeList(); QgsExpressionNode::NodeList *opArgs = new QgsExpressionNode::NodeList();
opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "$geometry" ) ), new QgsExpressionNode::NodeList() ) ); opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "$geometry" ) ), new QgsExpressionNode::NodeList() ) );
opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "geomFromGML" ) ), gml2Args ) ); opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "geomFromGML" ) ), gml2Args.release() ) );


return new QgsExpressionNodeFunction( opIdx, opArgs ); return new QgsExpressionNodeFunction( opIdx, opArgs );
} }
Expand Down

0 comments on commit 180d6b3

Please sign in to comment.