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 629ad67af927..8b6de86c0d62 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 f132132238bf..d76524582a34 100644 --- a/src/App/PropertyGeo.h +++ b/src/App/PropertyGeo.h @@ -68,7 +68,7 @@ class AppExport PropertyVector: public Property * A destructor. * A more elaborate description of the destructor. */ - ~PropertyVector(); + virtual ~PropertyVector(); /** Sets the property */ @@ -115,7 +115,7 @@ class AppExport PropertyVectorList: public PropertyLists * 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 @@ class AppExport PropertyMatrix: public Property * A destructor. * A more elaborate description of the destructor. */ - ~PropertyMatrix(); + virtual ~PropertyMatrix(); /** Sets the property */ @@ -226,7 +226,7 @@ class AppExport PropertyPlacement: public Property * A destructor. * A more elaborate description of the destructor. */ - ~PropertyPlacement(); + virtual ~PropertyPlacement(); /** Sets the property */ @@ -276,7 +276,7 @@ class AppExport PropertyPlacementLink : public PropertyLink * 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 da31de5e9da1..c79657c5a1a7 100644 --- a/src/App/PropertyLinks.h +++ b/src/App/PropertyLinks.h @@ -58,7 +58,7 @@ class AppExport PropertyLink : public Property * A destructor. * A more elaborate description of the destructor. */ - ~PropertyLink(); + virtual ~PropertyLink(); /** Sets the property */ @@ -120,7 +120,7 @@ class AppExport PropertyLinkSub: public Property * 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 91c8b3c594f1..ea818207e58d 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 @@ class AppExport PropertyEnumeration: public PropertyInteger PropertyEnumeration(); /// destructor - ~PropertyEnumeration(); + virtual ~PropertyEnumeration(); /// Enumeration methods //@{ @@ -207,7 +207,7 @@ class AppExport PropertyIntegerConstraint: public PropertyInteger PropertyIntegerConstraint(); /// destructor - ~PropertyIntegerConstraint(); + virtual ~PropertyIntegerConstraint(); /// Constraint methods //@{ @@ -249,7 +249,7 @@ class AppExport PropertyPercent: public PropertyIntegerConstraint PropertyPercent(); /// destructor - ~PropertyPercent(); + virtual ~PropertyPercent(); }; /** Integer list properties @@ -271,7 +271,7 @@ class AppExport PropertyIntegerList: public PropertyLists * 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 @@ class AppExport PropertyIntegerSet: public Property * A destructor. * A more elaborate description of the destructor. */ - ~PropertyIntegerSet(); + virtual ~PropertyIntegerSet(); /** Sets the property */ @@ -367,7 +367,7 @@ class AppExport PropertyMap: public Property * A destructor. * A more elaborate description of the destructor. */ - ~PropertyMap(); + virtual ~PropertyMap(); virtual int getSize(void) const; @@ -670,7 +670,7 @@ class AppExport PropertyStringList: public PropertyLists * 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 @@ class AppExport PropertyColor : public Property * A destructor. * A more elaborate description of the destructor. */ - ~PropertyColor(); + virtual ~PropertyColor(); /** Sets the property */ @@ -850,7 +850,7 @@ class AppExport PropertyColorList: public PropertyLists * 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 @@ class AppExport PropertyMaterial : public Property * 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 1c48a9645e21..82c885b1d99b 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -60,8 +60,8 @@ class InputValidator : public QValidator 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 b4c3057dc55e..685dcb89ca77 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 d5ff421c3c09..c2ffb344201d 100644 --- a/src/Mod/Mesh/App/Mesh.h +++ b/src/Mod/Mesh/App/Mesh.h @@ -82,7 +82,7 @@ class MeshExport MeshObject : public Data::ComplexGeoData 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 68d7ebcc48a2..520363a79561 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 034411bad3d5..a4bfdd410bf7 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; }