File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -4900,8 +4900,12 @@ QVariant QgsArrayFilterExpressionFunction::run( QgsExpressionNode::NodeList *arg
4900
4900
const QVariantList array = args->at ( 0 )->eval ( parent, context ).toList ();
4901
4901
4902
4902
QgsExpressionContext *subContext = const_cast <QgsExpressionContext *>( context );
4903
- if ( !context )
4904
- subContext = new QgsExpressionContext ();
4903
+ std::unique_ptr< QgsExpressionContext > tempContext;
4904
+ if ( !subContext )
4905
+ {
4906
+ tempContext = qgis::make_unique< QgsExpressionContext >();
4907
+ subContext = tempContext.get ();
4908
+ }
4905
4909
4906
4910
QgsExpressionContextScope *subScope = new QgsExpressionContextScope ();
4907
4911
subContext->appendScope ( subScope );
@@ -4913,8 +4917,8 @@ QVariant QgsArrayFilterExpressionFunction::run( QgsExpressionNode::NodeList *arg
4913
4917
result << value;
4914
4918
}
4915
4919
4916
- if ( ! context )
4917
- delete subContext;
4920
+ if ( context )
4921
+ delete subContext-> popScope () ;
4918
4922
4919
4923
return result;
4920
4924
}
You can’t perform that action at this time.
0 commit comments