From 6b1e6a66ad093fe65610a29c0bd25aaacd13bc0e Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 26 Jul 2014 19:17:12 +0200 Subject: [PATCH] + Make destructor virtual for classes with virtual methods (based on DevJohan's patch) --- src/App/ComplexGeoData.h | 1 + src/App/PropertyGeo.h | 14 ++++++------ src/App/PropertyLinks.h | 4 ++-- src/App/PropertyStandard.h | 26 +++++++++++----------- src/Gui/InputField.cpp | 2 +- src/Mod/Mesh/App/Core/Algorithm.h | 3 +++ src/Mod/Mesh/App/Mesh.h | 2 +- src/Mod/Sketcher/App/Constraint.h | 2 +- src/Mod/Sketcher/App/freegcs/Constraints.h | 1 + 9 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/App/ComplexGeoData.h b/src/App/ComplexGeoData.h index 629ad67af..8b6de86c0 100644 --- a/src/App/ComplexGeoData.h +++ b/src/App/ComplexGeoData.h @@ -48,6 +48,7 @@ class AppExport Segment: public Base::BaseClass TYPESYSTEM_HEADER(); public: + virtual ~Segment(){} virtual std::string getName() const=0; }; diff --git a/src/App/PropertyGeo.h b/src/App/PropertyGeo.h index f13213223..d76524582 100644 --- a/src/App/PropertyGeo.h +++ b/src/App/PropertyGeo.h @@ -68,7 +68,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyVector(); + virtual ~PropertyVector(); /** Sets the property */ @@ -115,7 +115,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyVectorList(); + virtual ~PropertyVectorList(); virtual void setSize(int newSize); virtual int getSize(void) const; @@ -178,7 +178,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyMatrix(); + virtual ~PropertyMatrix(); /** Sets the property */ @@ -226,7 +226,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyPlacement(); + virtual ~PropertyPlacement(); /** Sets the property */ @@ -276,7 +276,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyPlacementLink(); + virtual ~PropertyPlacementLink(); /** This method returns the linked DocumentObject */ @@ -295,7 +295,7 @@ class AppExport PropertyGeometry : public App::Property public: PropertyGeometry(); - ~PropertyGeometry(); + virtual ~PropertyGeometry(); /** @name Modification */ //@{ @@ -315,7 +315,7 @@ class AppExport PropertyComplexGeoData : public App::PropertyGeometry public: PropertyComplexGeoData(); - ~PropertyComplexGeoData(); + virtual ~PropertyComplexGeoData(); /** @name Modification */ //@{ diff --git a/src/App/PropertyLinks.h b/src/App/PropertyLinks.h index da31de5e9..c79657c5a 100644 --- a/src/App/PropertyLinks.h +++ b/src/App/PropertyLinks.h @@ -58,7 +58,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyLink(); + virtual ~PropertyLink(); /** Sets the property */ @@ -120,7 +120,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyLinkSub(); + virtual ~PropertyLinkSub(); /** Sets the property */ diff --git a/src/App/PropertyStandard.h b/src/App/PropertyStandard.h index 91c8b3c59..ea818207e 100644 --- a/src/App/PropertyStandard.h +++ b/src/App/PropertyStandard.h @@ -54,7 +54,7 @@ class AppExport PropertyInteger: public Property public: PropertyInteger(); - ~PropertyInteger(); + virtual ~PropertyInteger(); /** Sets the property */ @@ -90,7 +90,7 @@ class AppExport PropertyPath: public Property public: PropertyPath(); - ~PropertyPath(); + virtual ~PropertyPath(); /** Sets the property */ @@ -142,7 +142,7 @@ public: PropertyEnumeration(); /// destructor - ~PropertyEnumeration(); + virtual ~PropertyEnumeration(); /// Enumeration methods //@{ @@ -207,7 +207,7 @@ public: PropertyIntegerConstraint(); /// destructor - ~PropertyIntegerConstraint(); + virtual ~PropertyIntegerConstraint(); /// Constraint methods //@{ @@ -249,7 +249,7 @@ public: PropertyPercent(); /// destructor - ~PropertyPercent(); + virtual ~PropertyPercent(); }; /** Integer list properties @@ -271,7 +271,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyIntegerList(); + virtual ~PropertyIntegerList(); virtual void setSize(int newSize); virtual int getSize(void) const; @@ -321,7 +321,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyIntegerSet(); + virtual ~PropertyIntegerSet(); /** Sets the property */ @@ -367,7 +367,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyMap(); + virtual ~PropertyMap(); virtual int getSize(void) const; @@ -670,7 +670,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyStringList(); + virtual ~PropertyStringList(); virtual void setSize(int newSize); virtual int getSize(void) const; @@ -756,7 +756,7 @@ class AppExport PropertyBoolList : public PropertyLists public: PropertyBoolList(); - ~PropertyBoolList(); + virtual ~PropertyBoolList(); virtual void setSize(int newSize); virtual int getSize(void) const; @@ -804,7 +804,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyColor(); + virtual ~PropertyColor(); /** Sets the property */ @@ -850,7 +850,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyColorList(); + virtual ~PropertyColorList(); virtual void setSize(int newSize); virtual int getSize(void) const; @@ -903,7 +903,7 @@ public: * A destructor. * A more elaborate description of the destructor. */ - ~PropertyMaterial(); + virtual ~PropertyMaterial(); /** Sets the property */ diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index 1c48a9645..82c885b1d 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -60,8 +60,8 @@ private: InputField::InputField(QWidget * parent) : QLineEdit(parent), - actUnitValue(0), validInput(true), + actUnitValue(0), Maximum(DOUBLE_MAX), Minimum(-DOUBLE_MAX), StepSize(1.0), diff --git a/src/Mod/Mesh/App/Core/Algorithm.h b/src/Mod/Mesh/App/Core/Algorithm.h index b4c3057dc..685dcb89c 100644 --- a/src/Mod/Mesh/App/Core/Algorithm.h +++ b/src/Mod/Mesh/App/Core/Algorithm.h @@ -318,6 +318,7 @@ class MeshExport MeshCollector { public: MeshCollector(){} + virtual ~MeshCollector(){} virtual void Append(const MeshCore::MeshKernel&, unsigned long index) = 0; }; @@ -325,6 +326,7 @@ class MeshExport PointCollector : public MeshCollector { public: PointCollector(std::vector& ind) : indices(ind){} + virtual ~PointCollector(){} virtual void Append(const MeshCore::MeshKernel& kernel, unsigned long index) { unsigned long ulP1, ulP2, ulP3; @@ -342,6 +344,7 @@ class MeshExport FacetCollector : public MeshCollector { public: FacetCollector(std::vector& ind) : indices(ind){} + virtual ~FacetCollector(){} void Append(const MeshCore::MeshKernel&, unsigned long index) { indices.push_back(index); diff --git a/src/Mod/Mesh/App/Mesh.h b/src/Mod/Mesh/App/Mesh.h index d5ff421c3..c2ffb3442 100644 --- a/src/Mod/Mesh/App/Mesh.h +++ b/src/Mod/Mesh/App/Mesh.h @@ -82,7 +82,7 @@ public: explicit MeshObject(const MeshCore::MeshKernel& Kernel); explicit MeshObject(const MeshCore::MeshKernel& Kernel, const Base::Matrix4D &Mtrx); MeshObject(const MeshObject&); - ~MeshObject(); + virtual ~MeshObject(); void operator = (const MeshObject&); diff --git a/src/Mod/Sketcher/App/Constraint.h b/src/Mod/Sketcher/App/Constraint.h index 68d7ebcc4..520363a79 100644 --- a/src/Mod/Sketcher/App/Constraint.h +++ b/src/Mod/Sketcher/App/Constraint.h @@ -56,9 +56,9 @@ class SketcherExport Constraint : public Base::Persistence TYPESYSTEM_HEADER(); public: - ~Constraint(); Constraint(); Constraint(const Constraint&); + virtual ~Constraint(); virtual Constraint *clone(void) const; static const int GeoUndef; diff --git a/src/Mod/Sketcher/App/freegcs/Constraints.h b/src/Mod/Sketcher/App/freegcs/Constraints.h index 034411bad..a4bfdd410 100644 --- a/src/Mod/Sketcher/App/freegcs/Constraints.h +++ b/src/Mod/Sketcher/App/freegcs/Constraints.h @@ -58,6 +58,7 @@ namespace GCS int tag; public: Constraint(); + virtual ~Constraint(){} inline VEC_pD params() { return pvec; }