Skip to content
Permalink
Browse files

Less manual memory management

  • Loading branch information
m-kuhn committed Aug 23, 2018
1 parent 901effc commit db99c77a897594d83d66425ea499dde422c23221
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/core/expression/qgsexpressionfunction.cpp
@@ -4900,8 +4900,12 @@ QVariant QgsArrayFilterExpressionFunction::run( QgsExpressionNode::NodeList *arg
const QVariantList array = args->at( 0 )->eval( parent, context ).toList();

QgsExpressionContext *subContext = const_cast<QgsExpressionContext *>( context );
if ( !context )
subContext = new QgsExpressionContext();
std::unique_ptr< QgsExpressionContext > tempContext;
if ( !subContext )
{
tempContext = qgis::make_unique< QgsExpressionContext >();
subContext = tempContext.get();
}

QgsExpressionContextScope *subScope = new QgsExpressionContextScope();
subContext->appendScope( subScope );
@@ -4913,8 +4917,8 @@ QVariant QgsArrayFilterExpressionFunction::run( QgsExpressionNode::NodeList *arg
result << value;
}

if ( !context )
delete subContext;
if ( context )
delete subContext->popScope();

return result;
}

0 comments on commit db99c77

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