diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp index 182366e9e4b8..9921fca61cba 100644 --- a/src/Base/PyObjectBase.cpp +++ b/src/Base/PyObjectBase.cpp @@ -62,6 +62,16 @@ 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 c0a748cd31b0..ad9aeb37e776 100644 --- a/src/Base/PyObjectBase.h +++ b/src/Base/PyObjectBase.h @@ -294,6 +294,9 @@ class BaseExport PyObjectBase : public PyObject _pcTwinPointer = 0; } + /// Overrides the pointer to the twin object + void setPointer(void* ptr, bool del=false); + bool isValid() { return StatusBits.test(Valid); }