diff --git a/src/App/Property.cpp b/src/App/Property.cpp index 68b824623c..2c97b9d22f 100644 --- a/src/App/Property.cpp +++ b/src/App/Property.cpp @@ -279,6 +279,8 @@ void Property::setStatus(Status pos, bool on) { } bool Property::isSame(const Property &other) const { + if(&other == this) + return true; if(other.getTypeId() != getTypeId() || getMemSize() != other.getMemSize()) return false; diff --git a/src/App/Property.h b/src/App/Property.h index f2ef4efeda..88d9deb748 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -32,6 +32,7 @@ #include #include #include +#include namespace Py { class Object; @@ -440,7 +441,7 @@ public: // if the order of the elements in the list relevant? // if yes, certain operations, like restoring must make sure that the // order is kept despite errors. - inline void setOrderRelevant(bool on) { this->setStatus(Status::Ordered,on); }; + inline void setOrderRelevant(bool on) { this->setStatus(Status::Ordered,on); } inline bool isOrderRelevant() const { return this->testStatus(Status::Ordered);} }; @@ -496,6 +497,8 @@ public: const_reference operator[] (int idx) const {return _lValueList[idx];} virtual bool isSame(const Property &other) const override { + if (&other == this) + return true; return this->getTypeId() == other.getTypeId() && this->getValue() == static_cast(&other)->getValue(); } diff --git a/src/App/PropertyFile.h b/src/App/PropertyFile.h index 9bc36df394..72dea92d47 100644 --- a/src/App/PropertyFile.h +++ b/src/App/PropertyFile.h @@ -104,6 +104,8 @@ public: virtual unsigned int getMemSize (void) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && _BaseFileName == static_cast(&other)->_BaseFileName && _OriginalName == static_cast(&other)->_OriginalName diff --git a/src/App/PropertyGeo.h b/src/App/PropertyGeo.h index 4291fdb99b..77825f52c1 100644 --- a/src/App/PropertyGeo.h +++ b/src/App/PropertyGeo.h @@ -109,6 +109,8 @@ public: } virtual bool isSame(const Property &other) const override { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -284,6 +286,8 @@ public: } virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -356,6 +360,8 @@ public: } virtual bool isSame(const Property &other) const override { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 2b82781b6c..1850f610ae 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -86,6 +86,8 @@ void PropertyLinkBase::hasSetValue() { bool PropertyLinkBase::isSame(const Property &other) const { + if(&other == this) + return true; if(other.isDerivedFrom(PropertyLinkBase::getClassTypeId()) || getScope() != static_cast(&other)->getScope()) return false; diff --git a/src/App/PropertyStandard.h b/src/App/PropertyStandard.h index 2e5766e464..7bc229bfdd 100644 --- a/src/App/PropertyStandard.h +++ b/src/App/PropertyStandard.h @@ -82,6 +82,8 @@ public: virtual const boost::any getPathValue(const App::ObjectIdentifier & /*path*/) const { return _lValue; } virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -128,6 +130,8 @@ public: virtual unsigned int getMemSize (void) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -228,6 +232,8 @@ public: virtual bool getPyPathValue(const ObjectIdentifier &path, Py::Object &r) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getEnum() == static_cast(&other)->getEnum(); } @@ -407,6 +413,8 @@ public: virtual unsigned int getMemSize (void) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValues() == static_cast(&other)->getValues(); } @@ -465,6 +473,8 @@ public: virtual unsigned int getMemSize (void) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValues() == static_cast(&other)->getValues(); } @@ -519,6 +529,8 @@ public: const boost::any getPathValue(const App::ObjectIdentifier &path) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -708,6 +720,8 @@ public: const boost::any getPathValue(const App::ObjectIdentifier &path) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getStrValue() == static_cast(&other)->getStrValue(); } @@ -756,6 +770,8 @@ public: virtual unsigned int getMemSize (void) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && _uuid.getValue() == static_cast(&other)->_uuid.getValue(); } @@ -778,6 +794,8 @@ public: { return "Gui::PropertyEditor::PropertyFontItem"; } virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -863,6 +881,8 @@ public: const boost::any getPathValue(const App::ObjectIdentifier &path) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -942,6 +962,8 @@ public: virtual unsigned int getMemSize (void) const{return sizeof(Color);} virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } @@ -1033,6 +1055,8 @@ public: virtual unsigned int getMemSize (void) const{return sizeof(_cMat);} virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue(); } diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h index 19b0cbb103..2b24e59095 100644 --- a/src/App/PropertyUnits.h +++ b/src/App/PropertyUnits.h @@ -72,6 +72,8 @@ public: virtual const boost::any getPathValue(const App::ObjectIdentifier &path) const; virtual bool isSame(const Property &other) const { + if (&other == this) + return true; return getTypeId() == other.getTypeId() && getValue() == static_cast(&other)->getValue() && _Unit == static_cast(&other)->_Unit;