App/Gui: fix memory leaks:

+ add function to cleanup units and quantities in debug build
+ fix reference leak in PropertyVector::getPyPathValue()
+ fix reference leak in PropertyPlacement::getPyPathValue()
+ in InterpreterSingleton::init() use a static std::vector<wchar_t*> instead of a C array
  to free memory at program end
+ in MainWindow::closeEvent() explicitly delete all task watchers
+ in ReportOutputObserver constructor pass parent to QObject
+ in PropertyEditor destructor explicitly delete QItemEditorFactory
This commit is contained in:
wmayer
2021-02-27 10:56:19 +01:00
parent 5d5d05616f
commit df0f979f3b
8 changed files with 41 additions and 11 deletions

View File

@@ -225,11 +225,11 @@ bool PropertyVector::getPyPathValue(const ObjectIdentifier &path, Py::Object &re
std::string p = path.getSubPathStr();
if (p == ".x") {
res = new QuantityPy(new Quantity(getValue().x,unit));
res = Py::asObject(new QuantityPy(new Quantity(getValue().x,unit)));
} else if(p == ".y") {
res = new QuantityPy(new Quantity(getValue().y,unit));
res = Py::asObject(new QuantityPy(new Quantity(getValue().y,unit)));
} else if(p == ".z") {
res = new QuantityPy(new Quantity(getValue().z,unit));
res = Py::asObject(new QuantityPy(new Quantity(getValue().z,unit)));
} else
return false;
return true;
@@ -678,13 +678,13 @@ bool PropertyPlacement::getPyPathValue(const ObjectIdentifier &path, Py::Object
if (p == ".Rotation.Angle") {
Base::Vector3d axis; double angle;
_cPos.getRotation().getValue(axis,angle);
res = new QuantityPy(new Quantity(Base::toDegrees(angle),Unit::Angle));
res = Py::asObject(new QuantityPy(new Quantity(Base::toDegrees(angle),Unit::Angle)));
} else if (p == ".Base.x") {
res = new QuantityPy(new Quantity(_cPos.getPosition().x,Unit::Length));
res = Py::asObject(new QuantityPy(new Quantity(_cPos.getPosition().x,Unit::Length)));
} else if (p == ".Base.y") {
res = new QuantityPy(new Quantity(_cPos.getPosition().y,Unit::Length));
res = Py::asObject(new QuantityPy(new Quantity(_cPos.getPosition().y,Unit::Length)));
} else if (p == ".Base.z") {
res = new QuantityPy(new Quantity(_cPos.getPosition().z,Unit::Length));
res = Py::asObject(new QuantityPy(new Quantity(_cPos.getPosition().z,Unit::Length)));
} else
return false;
return true;