If a DataSet is loaded (for example, by evaluating planet(earth)), but not all of its properties are initialized, attempting to delete Calculator results in a segmentation fault. The following example code triggers this:
auto* calc = new Calculator(true);
calc->loadGlobalDefinitions();
calc->calculate("planet(earth)");
delete calc;
This patch adds a null check before calling MathStructure::unref() in DataObject's destructor.
If a
DataSet
is loaded (for example, by evaluatingplanet(earth)
), but not all of its properties are initialized, attempting to deleteCalculator
results in a segmentation fault. The following example code triggers this:This patch adds a null check before calling MathStructure::unref() in DataObject's destructor.