[SCM] qgis branch, master, updated. a2ee769957385f4e084c5e8b6ba178a8c877d1db

Giuseppe Sucameli brush.tyler at gmail.com
Tue Mar 20 13:43:38 UTC 2012


The following commit has been merged in the master branch:
commit 2c0fb43986aa00fb954851d4519f9a82a1c10cef
Author: Giuseppe Sucameli <brush.tyler at gmail.com>
Date:   Wed Mar 14 00:58:26 2012 +0100

    fix memory leak instantiating QgsExpression in actions

diff --git a/src/core/qgsattributeaction.cpp b/src/core/qgsattributeaction.cpp
index b5a8fe5..1fc78f7 100644
--- a/src/core/qgsattributeaction.cpp
+++ b/src/core/qgsattributeaction.cpp
@@ -206,7 +206,7 @@ QString QgsAttributeAction::expandAction( QString action, QgsFeature &feat, cons
     index = pos + rx.matchedLength();
 
     QString to_replace = rx.cap( 1 ).trimmed();
-    QgsDebugMsg( "Found expression:" + to_replace );
+    QgsDebugMsg( "Found expression: " + to_replace );
 
     if ( substitutionMap && substitutionMap->contains( to_replace ) )
     {
@@ -214,18 +214,18 @@ QString QgsAttributeAction::expandAction( QString action, QgsFeature &feat, cons
       continue;
     }
 
-    QgsExpression* exp = new QgsExpression( to_replace );
-    if ( exp->hasParserError() )
+    QgsExpression exp( to_replace );
+    if ( exp.hasParserError() )
     {
-      QgsDebugMsg( "Expression parser error:" + exp->parserErrorString() );
+      QgsDebugMsg( "Expression parser error: " + exp.parserErrorString() );
       expr_action += action.mid( start, index - start );
       continue;
     }
 
-    QVariant result = exp->evaluate( &feat, mLayer->pendingFields() );
-    if ( exp->hasEvalError() )
+    QVariant result = exp.evaluate( &feat, mLayer->pendingFields() );
+    if ( exp.hasEvalError() )
     {
-      QgsDebugMsg( "Expression parser eval error:" + exp->evalErrorString() );
+      QgsDebugMsg( "Expression parser eval error: " + exp.evalErrorString() );
       expr_action += action.mid( start, index - start );
       continue;
     }

-- 
The Quantum GIS in Debian project



More information about the Pkg-grass-devel mailing list