Add DataFilter destructor calling clearFilter to release memory

The crash documented in #4249 was related to the conversion of
Leaf of type Symbol to Function when () are found afterwards.
This is fixed in this commit, but more testing is necessary to
see if there are other cases.
This commit is contained in:
Alejandro Martinez
2022-10-13 11:55:40 -03:00
committed by Mark Liversedge
parent d5905d92d0
commit 327150d659
2 changed files with 3 additions and 0 deletions

View File

@@ -219,6 +219,7 @@ class DataFilter : public QObject
public:
DataFilter(QObject *parent, Context *context);
DataFilter(QObject *parent, Context *context, QString formula);
~DataFilter() { clearFilter(); }
// runtime passed by datafilter
DataFilterRuntime rt;

View File

@@ -458,6 +458,8 @@ expr:
$1->type = Leaf::Function;
$1->series = NULL; // not tiz/best
$1->function = *($1->lvalue.n);
delete $1->lvalue.n; // not used anymore
$1->lvalue.l = NULL; // avoid double deletion
$1->fparms.clear(); // no parameters!
}
| '(' expr ')' { $$ = new Leaf(@2.first_column, @2.last_column);