From 1a15d566d59c002429c8a1166987e7fa7bcaffad Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 28 Sep 2020 20:23:33 +0200 Subject: [PATCH] Part: [skip ci] include OCC hesder to PCHs, fix compiler warning when trying to delete void pointer --- src/Base/PyObjectBase.cpp | 10 ---------- src/Base/PyObjectBase.h | 8 +++++--- src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp | 2 +- src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp | 2 +- src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp | 2 +- src/Mod/Part/App/OpenCascadeAll.h | 1 + 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp index 9921fca61c..182366e9e4 100644 --- a/src/Base/PyObjectBase.cpp +++ b/src/Base/PyObjectBase.cpp @@ -62,16 +62,6 @@ PyObjectBase::~PyObjectBase() Py_XDECREF(attrDict); } -void PyObjectBase::setPointer(void* ptr, bool del) -{ - if (_pcTwinPointer == ptr) - return; - - if (del) - delete _pcTwinPointer; - _pcTwinPointer = ptr; -} - /*------------------------------ * PyObjectBase Type -- Every class, even the abstract one should have a Type ------------------------------*/ diff --git a/src/Base/PyObjectBase.h b/src/Base/PyObjectBase.h index ad9aeb37e7..324348dbe0 100644 --- a/src/Base/PyObjectBase.h +++ b/src/Base/PyObjectBase.h @@ -212,6 +212,11 @@ protected: /// destructor virtual ~PyObjectBase(); + /// Overrides the pointer to the twin object + void setTwinPointer(void* ptr) { + _pcTwinPointer = ptr; + } + public: /** Constructor * Sets the Type of the object (for inheritance) and decrease the @@ -294,9 +299,6 @@ public: _pcTwinPointer = 0; } - /// Overrides the pointer to the twin object - void setPointer(void* ptr, bool del=false); - bool isValid() { return StatusBits.test(Valid); } diff --git a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp index 7cfdb8d904..d67e156aa2 100644 --- a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp @@ -116,7 +116,7 @@ int BuildPlateSurfacePy::PyInit(PyObject* args, PyObject* kwds) ptr->LoadInitSurface(handle); } - setPointer(ptr.release()); + setTwinPointer(ptr.release()); return 0; } diff --git a/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp b/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp index 62af3356d2..3271f3651a 100644 --- a/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp @@ -93,7 +93,7 @@ int CurveConstraintPy::PyInit(PyObject* args, PyObject* kwds) ptr.reset(new GeomPlate_CurveConstraint); } - setPointer(ptr.release()); + setTwinPointer(ptr.release()); return 0; } diff --git a/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp b/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp index 67ffc2e948..66cdfb8753 100644 --- a/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp @@ -58,7 +58,7 @@ int PointConstraintPy::PyInit(PyObject* args, PyObject* kwds) Base::Vector3d v = static_cast(pt)->value(); ptr.reset(new GeomPlate_PointConstraint(gp_Pnt(v.x, v.y, v.z), order, tolDist)); - setPointer(ptr.release()); + setTwinPointer(ptr.release()); return 0; } diff --git a/src/Mod/Part/App/OpenCascadeAll.h b/src/Mod/Part/App/OpenCascadeAll.h index c12221502a..d16089e6d5 100644 --- a/src/Mod/Part/App/OpenCascadeAll.h +++ b/src/Mod/Part/App/OpenCascadeAll.h @@ -321,6 +321,7 @@ #include #include #include +#include #include #include #include