Add virtual constructors to some classes that should have them

This is more for safety from undefined deletion behavior than
anything else (it also silences the Clang -Wnon-virtual-dtor warning).
This commit is contained in:
Ian McInerney 2020-02-05 22:19:14 +00:00
parent e94f356ad5
commit 34e5b76c5f
21 changed files with 158 additions and 18 deletions

View File

@ -40,6 +40,10 @@ class CPROCEDURALGENERATOR
public: public:
CPROCEDURALGENERATOR(); CPROCEDURALGENERATOR();
virtual ~CPROCEDURALGENERATOR()
{
}
/** /**
* @brief Generate - Generates a 3D vector based on the ray and * @brief Generate - Generates a 3D vector based on the ray and
* hit information depending on the implementation * hit information depending on the implementation
@ -62,6 +66,10 @@ public:
CBOARDNORMAL() : CPROCEDURALGENERATOR() { m_scale = 1.0f; } CBOARDNORMAL() : CPROCEDURALGENERATOR() { m_scale = 1.0f; }
CBOARDNORMAL( float aScale ); CBOARDNORMAL( float aScale );
virtual ~CBOARDNORMAL()
{
}
// Imported from CPROCEDURALGENERATOR // Imported from CPROCEDURALGENERATOR
SFVEC3F Generate( const RAY &aRay, SFVEC3F Generate( const RAY &aRay,
const HITINFO &aHitInfo ) const override; const HITINFO &aHitInfo ) const override;
@ -81,6 +89,10 @@ public:
CCOPPERNORMAL( float aScale, const CPROCEDURALGENERATOR *aBoardNormalGenerator ); CCOPPERNORMAL( float aScale, const CPROCEDURALGENERATOR *aBoardNormalGenerator );
virtual ~CCOPPERNORMAL()
{
}
// Imported from CPROCEDURALGENERATOR // Imported from CPROCEDURALGENERATOR
SFVEC3F Generate( const RAY &aRay, SFVEC3F Generate( const RAY &aRay,
const HITINFO &aHitInfo ) const override; const HITINFO &aHitInfo ) const override;
@ -97,6 +109,10 @@ public:
CSOLDERMASKNORMAL() : CPROCEDURALGENERATOR() { m_copper_normal_generator = NULL; } CSOLDERMASKNORMAL() : CPROCEDURALGENERATOR() { m_copper_normal_generator = NULL; }
CSOLDERMASKNORMAL( const CPROCEDURALGENERATOR *aCopperNormalGenerator ); CSOLDERMASKNORMAL( const CPROCEDURALGENERATOR *aCopperNormalGenerator );
virtual ~CSOLDERMASKNORMAL()
{
}
// Imported from CPROCEDURALGENERATOR // Imported from CPROCEDURALGENERATOR
SFVEC3F Generate( const RAY &aRay, SFVEC3F Generate( const RAY &aRay,
const HITINFO &aHitInfo ) const override; const HITINFO &aHitInfo ) const override;
@ -116,6 +132,10 @@ public:
CPLASTICNORMAL( float aScale ); CPLASTICNORMAL( float aScale );
virtual ~CPLASTICNORMAL()
{
}
// Imported from CPROCEDURALGENERATOR // Imported from CPROCEDURALGENERATOR
SFVEC3F Generate( const RAY &aRay, SFVEC3F Generate( const RAY &aRay,
const HITINFO &aHitInfo ) const override; const HITINFO &aHitInfo ) const override;
@ -136,6 +156,10 @@ public:
CPLASTICSHINENORMAL( float aScale ); CPLASTICSHINENORMAL( float aScale );
virtual ~CPLASTICSHINENORMAL()
{
}
// Imported from CPROCEDURALGENERATOR // Imported from CPROCEDURALGENERATOR
SFVEC3F Generate( const RAY &aRay, SFVEC3F Generate( const RAY &aRay,
const HITINFO &aHitInfo ) const override; const HITINFO &aHitInfo ) const override;
@ -155,6 +179,10 @@ public:
CMETALBRUSHEDNORMAL( float aScale ); CMETALBRUSHEDNORMAL( float aScale );
virtual ~CMETALBRUSHEDNORMAL()
{
}
// Imported from CPROCEDURALGENERATOR // Imported from CPROCEDURALGENERATOR
SFVEC3F Generate( const RAY &aRay, SFVEC3F Generate( const RAY &aRay,
const HITINFO &aHitInfo ) const override; const HITINFO &aHitInfo ) const override;

View File

@ -89,6 +89,10 @@ class CCAMERA
*/ */
explicit CCAMERA( float aRangeScale ); explicit CCAMERA( float aRangeScale );
virtual ~CCAMERA()
{
}
/** /**
* Function GetRotationMatrix * Function GetRotationMatrix

View File

@ -40,6 +40,10 @@ class CTRACK_BALL : public CCAMERA
explicit CTRACK_BALL( float aRangeScale ); explicit CTRACK_BALL( float aRangeScale );
virtual ~CTRACK_BALL()
{
}
void Drag( const wxPoint &aNewMousePosition ) override; void Drag( const wxPoint &aNewMousePosition ) override;
void Pan( const wxPoint &aNewMousePosition ) override; void Pan( const wxPoint &aNewMousePosition ) override;

View File

@ -233,6 +233,10 @@ public:
RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet, RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet,
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackeEndType ); EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackeEndType );
virtual ~RESCUER()
{
}
/** /**
* Writes out the rescue library. Called after successful PerformAction()s. If this fails, * Writes out the rescue library. Called after successful PerformAction()s. If this fails,
* undo the actions. * undo the actions.
@ -316,6 +320,10 @@ public:
{ {
} }
virtual ~LEGACY_RESCUER()
{
}
virtual void FindCandidates() override; virtual void FindCandidates() override;
virtual void InvokeDialog( wxWindow* aParent, bool aAskShowAgain ) override; virtual void InvokeDialog( wxWindow* aParent, bool aAskShowAgain ) override;
@ -339,6 +347,10 @@ public:
SYMBOL_LIB_TABLE_RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet, SYMBOL_LIB_TABLE_RESCUER( PROJECT& aProject, SCH_SHEET_PATH* aCurrentSheet,
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackeEndType ); EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackeEndType );
virtual ~SYMBOL_LIB_TABLE_RESCUER()
{
}
virtual void FindCandidates() override; virtual void FindCandidates() override;
virtual void InvokeDialog( wxWindow* aParent, bool aAskShowAgain ) override; virtual void InvokeDialog( wxWindow* aParent, bool aAskShowAgain ) override;

View File

@ -49,6 +49,10 @@ struct BOARD_PRINTOUT_SETTINGS : public PRINTOUT_SETTINGS
{ {
BOARD_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo ); BOARD_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
virtual ~BOARD_PRINTOUT_SETTINGS()
{
}
LSET m_layerSet; ///< Layers to print LSET m_layerSet; ///< Layers to print
bool m_mirror; ///< Print mirrored bool m_mirror; ///< Print mirrored

View File

@ -39,6 +39,10 @@
class APIEXPORT LIB_TREE_ITEM class APIEXPORT LIB_TREE_ITEM
{ {
public: public:
virtual ~LIB_TREE_ITEM()
{
}
virtual LIB_ID GetLibId() const = 0; virtual LIB_ID GetLibId() const = 0;
virtual wxString GetName() const = 0; virtual wxString GetName() const = 0;

View File

@ -58,6 +58,10 @@ public:
///> Called when the polygon is complete ///> Called when the polygon is complete
virtual void OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) = 0; virtual void OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) = 0;
virtual ~CLIENT()
{
}
}; };
/** /**

View File

@ -38,6 +38,10 @@ struct PRINTOUT_SETTINGS
m_pageCount = 0; m_pageCount = 0;
} }
virtual ~PRINTOUT_SETTINGS()
{
}
virtual void Save( wxConfigBase* aConfig ); virtual void Save( wxConfigBase* aConfig );
virtual void Load( wxConfigBase* aConfig ); virtual void Load( wxConfigBase* aConfig );

View File

@ -74,7 +74,7 @@ public:
}; };
PROJECT(); PROJECT();
~PROJECT(); VTBL_ENTRY ~PROJECT();
//-----<Cross Module API>---------------------------------------------------- //-----<Cross Module API>----------------------------------------------------

View File

@ -134,6 +134,10 @@ public:
* Returns true if the reporter client is non-empty. * Returns true if the reporter client is non-empty.
*/ */
virtual bool HasMessage() const = 0; virtual bool HasMessage() const = 0;
virtual ~REPORTER()
{
}
}; };
@ -152,6 +156,10 @@ public:
{ {
} }
virtual ~WX_TEXT_CTRL_REPORTER()
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
bool HasMessage() const override; bool HasMessage() const override;
@ -173,6 +181,10 @@ public:
{ {
} }
virtual ~WX_STRING_REPORTER()
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
bool HasMessage() const override; bool HasMessage() const override;
@ -194,6 +206,10 @@ public:
{ {
} }
virtual ~WX_HTML_PANEL_REPORTER()
{
}
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
REPORTER& ReportTail( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; REPORTER& ReportTail( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
@ -216,6 +232,10 @@ public:
{ {
} }
virtual ~NULL_REPORTER()
{
}
static REPORTER& GetInstance(); static REPORTER& GetInstance();
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
@ -235,6 +255,10 @@ public:
{ {
} }
virtual ~STDOUT_REPORTER()
{
}
static REPORTER& GetInstance(); static REPORTER& GetInstance();
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;

View File

@ -43,6 +43,10 @@ protected:
public: public:
LAYER_SELECTOR(); LAYER_SELECTOR();
virtual ~LAYER_SELECTOR()
{
}
// Returns a color index from the layer id // Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class // Virtual function because GerbView uses its own functions in a derived class
virtual COLOR4D GetLayerColor( LAYER_NUM aLayer ) const = 0; virtual COLOR4D GetLayerColor( LAYER_NUM aLayer ) const = 0;

View File

@ -44,6 +44,10 @@ class PROGRESS_REPORTER
PROGRESS_REPORTER( int aNumPhases ); PROGRESS_REPORTER( int aNumPhases );
PROGRESS_REPORTER( const PROGRESS_REPORTER& ) = delete; PROGRESS_REPORTER( const PROGRESS_REPORTER& ) = delete;
virtual ~PROGRESS_REPORTER()
{
}
/** /**
* initialize the aPhase virtual zone of the dialog progress bar * initialize the aPhase virtual zone of the dialog progress bar
*/ */

View File

@ -53,6 +53,10 @@ namespace PCAD2KICAD
class PCB_CALLBACKS class PCB_CALLBACKS
{ {
public: public:
virtual ~PCB_CALLBACKS()
{
}
virtual PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) = 0; virtual PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) = 0;
virtual LAYER_TYPE_T GetLayerType( int aPCadLayer ) = 0; virtual LAYER_TYPE_T GetLayerType( int aPCadLayer ) = 0;
virtual wxString GetLayerNetNameRef( int aPCadLayer ) = 0; virtual wxString GetLayerNetNameRef( int aPCadLayer ) = 0;

View File

@ -210,6 +210,10 @@ struct NODE::DEFAULT_OBSTACLE_VISITOR : public OBSTACLE_VISITOR
} }
} }
virtual ~DEFAULT_OBSTACLE_VISITOR()
{
}
void SetCountLimit( int aLimit ) void SetCountLimit( int aLimit )
{ {
m_limitCount = aLimit; m_limitCount = aLimit;
@ -483,6 +487,10 @@ struct HIT_VISITOR : public OBSTACLE_VISITOR
m_items( aTab ), m_point( aPoint ) m_items( aTab ), m_point( aPoint )
{} {}
virtual ~HIT_VISITOR()
{
}
bool operator()( ITEM* aItem ) override bool operator()( ITEM* aItem ) override
{ {
SHAPE_CIRCLE cp( m_point, 0 ); SHAPE_CIRCLE cp( m_point, 0 );

View File

@ -104,6 +104,10 @@ public:
OBSTACLE_VISITOR( const ITEM* aItem ); OBSTACLE_VISITOR( const ITEM* aItem );
virtual ~OBSTACLE_VISITOR()
{
}
void SetWorld( const NODE* aNode, const NODE* aOverride = NULL ); void SetWorld( const NODE* aNode, const NODE* aOverride = NULL );
virtual bool operator()( ITEM* aCandidate ) = 0; virtual bool operator()( ITEM* aCandidate ) = 0;

View File

@ -1593,6 +1593,10 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
VIA_PLACER( PCB_BASE_EDIT_FRAME* aFrame ) : m_gridHelper( aFrame ) VIA_PLACER( PCB_BASE_EDIT_FRAME* aFrame ) : m_gridHelper( aFrame )
{} {}
virtual ~VIA_PLACER()
{
}
TRACK* findTrack( VIA* aVia ) TRACK* findTrack( VIA* aVia )
{ {
const LSET lset = aVia->GetLayerSet(); const LSET lset = aVia->GetLayerSet();

View File

@ -290,6 +290,10 @@ int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
struct PAD_PLACER : public INTERACTIVE_PLACER_BASE struct PAD_PLACER : public INTERACTIVE_PLACER_BASE
{ {
virtual ~PAD_PLACER()
{
}
std::unique_ptr<BOARD_ITEM> CreateItem() override std::unique_ptr<BOARD_ITEM> CreateItem() override
{ {
D_PAD* pad = new D_PAD( m_board->GetFirstModule() ); D_PAD* pad = new D_PAD( m_board->GetFirstModule() );

View File

@ -65,6 +65,10 @@ int MICROWAVE_TOOL::addMicrowaveFootprint( const TOOL_EVENT& aEvent )
m_itemType( aType ) m_itemType( aType )
{ }; { };
virtual ~MICROWAVE_PLACER()
{
}
std::unique_ptr<BOARD_ITEM> CreateItem() override std::unique_ptr<BOARD_ITEM> CreateItem() override
{ {
switch( m_itemType ) switch( m_itemType )

View File

@ -51,6 +51,10 @@ class PCBNEW_SELECTION;
struct INTERACTIVE_PLACER_BASE struct INTERACTIVE_PLACER_BASE
{ {
virtual ~INTERACTIVE_PLACER_BASE()
{
}
virtual std::unique_ptr<BOARD_ITEM> CreateItem() = 0; virtual std::unique_ptr<BOARD_ITEM> CreateItem() = 0;
virtual void SnapItem( BOARD_ITEM *aItem ); virtual void SnapItem( BOARD_ITEM *aItem );
virtual bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit ); virtual bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit );

View File

@ -71,7 +71,7 @@ public:
*/ */
ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, PARAMS& aParams ); ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, PARAMS& aParams );
~ZONE_CREATE_HELPER(); virtual ~ZONE_CREATE_HELPER();
/* /*
* Interface for receiving POLYGON_GEOM_MANAGER update * Interface for receiving POLYGON_GEOM_MANAGER update

View File

@ -64,6 +64,10 @@ public:
{ {
} }
virtual ~DRC_RUNNER()
{
}
void Execute( BOARD& aBoard ) void Execute( BOARD& aBoard )
{ {
if( m_exec_context.m_verbose ) if( m_exec_context.m_verbose )
@ -151,6 +155,10 @@ public:
{ {
} }
virtual ~DRC_COURTYARD_OVERLAP_RUNNER()
{
}
private: private:
std::string getRunnerIntro() const override std::string getRunnerIntro() const override
{ {
@ -184,6 +192,10 @@ public:
{ {
} }
virtual ~DRC_COURTYARD_MISSING_RUNNER()
{
}
private: private:
std::string getRunnerIntro() const override std::string getRunnerIntro() const override
{ {