diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp index db5862f1c1..c2d0f4f2d5 100644 --- a/src/App/Expression.cpp +++ b/src/App/Expression.cpp @@ -2610,7 +2610,7 @@ Py::Object FunctionExpression::_getPyValue() const { Expression *FunctionExpression::simplify() const { size_t numerics = 0; - std::vector a; + std::vector simplifiedArgs; // Try to simplify each argument to function for (auto it : args) { @@ -2618,20 +2618,21 @@ Expression *FunctionExpression::simplify() const if (freecad_cast(v)) ++numerics; - a.push_back(v); + simplifiedArgs.push_back(v); } if (numerics == args.size()) { // All constants, then evaluation must also be constant - // Clean-up - for (auto it : args) + // Clean-up the simplified arguments + for (auto it : simplifiedArgs) delete it; return eval(); } else - return new FunctionExpression(owner, f, std::string(fname), std::move(a)); + return new FunctionExpression(owner, f, std::string(fname), + std::move(simplifiedArgs)); } /**