diff --git a/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.h b/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.h index 0c12795785..fc58e1f47c 100644 --- a/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.h +++ b/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.h @@ -115,6 +115,11 @@ public: ~BVH_PBRT(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + BVH_PBRT( const BVH_PBRT& ) = delete; + BVH_PBRT& operator=( const BVH_PBRT& ) = delete; + bool Intersect( const RAY& aRay, HITINFO& aHitInfo ) const override; bool Intersect( const RAY& aRay, HITINFO& aHitInfo, unsigned int aAccNodeInfo ) const override; bool Intersect( const RAYPACKET& aRayPacket, HITINFO_PACKET* aHitInfoPacket ) const override; diff --git a/3d-viewer/3d_rendering/raytracing/accelerators/container_2d.h b/3d-viewer/3d_rendering/raytracing/accelerators/container_2d.h index 21100237a8..2720981aae 100644 --- a/3d-viewer/3d_rendering/raytracing/accelerators/container_2d.h +++ b/3d-viewer/3d_rendering/raytracing/accelerators/container_2d.h @@ -22,12 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file container_2d.h - */ - -#ifndef _CONTAINER_2D_H_ -#define _CONTAINER_2D_H_ +#pragma once #include "../shapes2D/object_2d.h" #include @@ -71,8 +66,7 @@ public: * @param aBBox The bounding box to test. * @param aOutList The list of objects that intersects the bounding box. */ - virtual void GetIntersectingObjects( const BBOX_2D& aBBox, - CONST_LIST_OBJECT2D& aOutList ) const = 0; + virtual void GetIntersectingObjects( const BBOX_2D& aBBox, CONST_LIST_OBJECT2D& aOutList ) const = 0; /** * Intersect and check if a segment ray hits a object or is inside it. @@ -83,11 +77,11 @@ public: virtual bool IntersectAny( const RAYSEG2D& aSegRay ) const = 0; protected: - BBOX_2D m_bbox; + BBOX_2D m_bbox; LIST_OBJECT2D m_objects; private: - std::mutex m_lock; + std::mutex m_lock; }; @@ -96,8 +90,7 @@ class CONTAINER_2D : public CONTAINER_2D_BASE public: CONTAINER_2D(); - void GetIntersectingObjects( const BBOX_2D& aBBox, - CONST_LIST_OBJECT2D& aOutList ) const override; + void GetIntersectingObjects( const BBOX_2D& aBBox, CONST_LIST_OBJECT2D& aOutList ) const override; bool IntersectAny( const RAYSEG2D& aSegRay ) const override; }; @@ -119,28 +112,30 @@ public: BVH_CONTAINER_2D(); ~BVH_CONTAINER_2D(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + BVH_CONTAINER_2D( const BVH_CONTAINER_2D& ) = delete; + BVH_CONTAINER_2D& operator=( const BVH_CONTAINER_2D& ) = delete; + void BuildBVH(); void Clear() override; - void GetIntersectingObjects( const BBOX_2D& aBBox, - CONST_LIST_OBJECT2D& aOutList ) const override; + void GetIntersectingObjects( const BBOX_2D& aBBox, CONST_LIST_OBJECT2D& aOutList ) const override; bool IntersectAny( const RAYSEG2D& aSegRay ) const override; private: void destroy(); void recursiveBuild_MIDDLE_SPLIT( BVH_CONTAINER_NODE_2D* aNodeParent ); - void recursiveGetListObjectsIntersects( const BVH_CONTAINER_NODE_2D* aNode, - const BBOX_2D& aBBox, + void recursiveGetListObjectsIntersects( const BVH_CONTAINER_NODE_2D* aNode, const BBOX_2D& aBBox, CONST_LIST_OBJECT2D& aOutList ) const; - bool recursiveIntersectAny( const BVH_CONTAINER_NODE_2D* aNode, - const RAYSEG2D& aSegRay ) const; + bool recursiveIntersectAny( const BVH_CONTAINER_NODE_2D* aNode, const RAYSEG2D& aSegRay ) const; - bool m_isInitialized; +private: + bool m_isInitialized; std::list m_elementsToDelete; - BVH_CONTAINER_NODE_2D* m_tree; + BVH_CONTAINER_NODE_2D* m_tree; }; -#endif // _CONTAINER_2D_H_ diff --git a/3d-viewer/3d_rendering/raytracing/shapes2D/layer_item_2d.h b/3d-viewer/3d_rendering/raytracing/shapes2D/layer_item_2d.h index 7248bb6dac..567eea78bf 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes2D/layer_item_2d.h +++ b/3d-viewer/3d_rendering/raytracing/shapes2D/layer_item_2d.h @@ -23,12 +23,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file layer_item_2d.h - */ - -#ifndef _LAYER_ITEM_2D_H_ -#define _LAYER_ITEM_2D_H_ +#pragma once #include "object_2d.h" #include @@ -84,6 +79,11 @@ public: ~LAYER_ITEM_2D(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + LAYER_ITEM_2D( const LAYER_ITEM_2D& ) = delete; + LAYER_ITEM_2D& operator=( const LAYER_ITEM_2D& ) = delete; + // Imported from OBJECT_2D bool Overlaps( const BBOX_2D& aBBox ) const override; bool Intersects( const BBOX_2D& aBBox ) const override; @@ -97,4 +97,3 @@ private: const OBJECT_2D* m_objectC; }; -#endif // _LAYER_ITEM_2D_H_ diff --git a/3d-viewer/dialogs/appearance_controls_3D.h b/3d-viewer/dialogs/appearance_controls_3D.h index 4f4d51ce39..0e36896841 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.h +++ b/3d-viewer/dialogs/appearance_controls_3D.h @@ -18,8 +18,7 @@ * with this program. If not, see . */ -#ifndef APPEARANCE_CONTROLS_3D_H -#define APPEARANCE_CONTROLS_3D_H +#pragma once #include @@ -113,6 +112,11 @@ public: APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner ); ~APPEARANCE_CONTROLS_3D(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + APPEARANCE_CONTROLS_3D( const APPEARANCE_CONTROLS_3D& ) = delete; + APPEARANCE_CONTROLS_3D& operator=( const APPEARANCE_CONTROLS_3D& ) = delete; + wxSize GetBestSize() const; void OnDarkModeToggle(); void OnLayerVisibilityChanged( int aLayer, bool isVisible ); @@ -189,5 +193,3 @@ private: wxCheckBox* m_cbUseBoardStackupColors; wxCheckBox* m_cbUseBoardEditorCopperColors; }; - -#endif diff --git a/common/eda_group.h b/common/eda_group.h index f51689b701..26a55570e0 100644 --- a/common/eda_group.h +++ b/common/eda_group.h @@ -73,7 +73,7 @@ public: const LIB_ID& GetDesignBlockLibId() const { return m_designBlockLibId; } protected: - std::unordered_set m_items; // Members of the group + std::unordered_set m_items; // Members of the group (no ownership) wxString m_name; // Optional group name LIB_ID m_designBlockLibId; // Optional link to a design block }; diff --git a/common/jobs/job.h b/common/jobs/job.h index 8dd83d91a6..81595cbadd 100644 --- a/common/jobs/job.h +++ b/common/jobs/job.h @@ -186,6 +186,11 @@ public: virtual ~JOB(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + JOB( const JOB& ) = delete; + JOB& operator=( const JOB& ) = delete; + const std::string& GetType() const { return m_type; }; const std::map& GetVarOverrides() const { return m_varOverrides; } diff --git a/common/single_top.cpp b/common/single_top.cpp index d832c088a3..fc89c3c3bb 100644 --- a/common/single_top.cpp +++ b/common/single_top.cpp @@ -260,8 +260,7 @@ struct APP_SINGLE_TOP : public wxApp if( dlgs.back() == dialog ) dlgs.pop_back(); // If an out-of-order, remove all dialogs added after the closed one - else if( auto it = std::find( dlgs.begin(), dlgs.end(), dialog ); - it != dlgs.end() ) + else if( auto it = std::find( dlgs.begin(), dlgs.end(), dialog ); it != dlgs.end() ) dlgs.erase( it, dlgs.end() ); } } diff --git a/common/widgets/grid_text_button_helpers.cpp b/common/widgets/grid_text_button_helpers.cpp index 4ad10b577c..ebf07eac06 100644 --- a/common/widgets/grid_text_button_helpers.cpp +++ b/common/widgets/grid_text_button_helpers.cpp @@ -350,8 +350,12 @@ public: ~TEXT_BUTTON_URL() { Unbind( wxEVT_TEXT, &TEXT_BUTTON_URL::OnTextChange, this ); + + m_filesStack.clear(); // we don't own pointers } + // We don't own any of our raw pointers, so compiler's copy c'tor an operator= are OK. + protected: void DoSetPopupControl( wxComboPopup* popup ) override { @@ -368,8 +372,7 @@ protected: { FILEDLG_HOOK_EMBED_FILE customize; - wxFileDialog openFileDialog( this, _( "Open file" ), "", "", - _( "All Files" ) + wxT( " (*.*)|*.*" ), + wxFileDialog openFileDialog( this, _( "Open file" ), "", "", _( "All Files" ) + wxT( " (*.*)|*.*" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); openFileDialog.SetCustomizeHook( customize ); @@ -414,8 +417,8 @@ protected: protected: DIALOG_SHIM* m_dlg; - SEARCH_STACK* m_searchStack; - std::vector m_filesStack; + SEARCH_STACK* m_searchStack; // No ownership of pointer + std::vector m_filesStack; // No ownership of pointers }; diff --git a/common/widgets/properties_panel.cpp b/common/widgets/properties_panel.cpp index 0ee84808a7..170f574700 100644 --- a/common/widgets/properties_panel.cpp +++ b/common/widgets/properties_panel.cpp @@ -158,7 +158,7 @@ void PROPERTIES_PANEL::OnLanguageChanged( wxCommandEvent& aEvent ) m_grid->CommitChangesFromEditor(); m_grid->Clear(); - m_displayed.clear(); + m_displayed.clear(); // no ownership of pointers UpdateData(); diff --git a/common/widgets/properties_panel.h b/common/widgets/properties_panel.h index 5759acf280..a78a487dee 100644 --- a/common/widgets/properties_panel.h +++ b/common/widgets/properties_panel.h @@ -108,7 +108,7 @@ public: int m_SuppressGridChangeEvents; protected: - std::vector m_displayed; + std::vector m_displayed; // no ownership of pointers wxPropertyGrid* m_grid; EDA_BASE_FRAME* m_frame; wxStaticText* m_caption; diff --git a/common/widgets/search_pane.cpp b/common/widgets/search_pane.cpp index f081f391af..5d0fd0a415 100644 --- a/common/widgets/search_pane.cpp +++ b/common/widgets/search_pane.cpp @@ -143,6 +143,11 @@ SEARCH_PANE::~SEARCH_PANE() m_frame->Unbind( EDA_LANG_CHANGED, &SEARCH_PANE::OnLanguageChange, this ); Unbind( wxEVT_CHAR_HOOK, &SEARCH_PANE::OnCharHook, this ); + for( SEARCH_HANDLER* handler : m_handlers ) + delete handler; + + m_handlers.clear(); + delete m_menu; } diff --git a/eeschema/connection_graph.h b/eeschema/connection_graph.h index 826f6d005d..f9ee569def 100644 --- a/eeschema/connection_graph.h +++ b/eeschema/connection_graph.h @@ -370,6 +370,11 @@ public: Reset(); } + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + CONNECTION_GRAPH( const CONNECTION_GRAPH& ) = delete; + CONNECTION_GRAPH& operator=( const CONNECTION_GRAPH& ) = delete; + void Reset(); void SetSchematic( SCHEMATIC* aSchematic ) diff --git a/eeschema/erc/erc_settings.h b/eeschema/erc/erc_settings.h index 3eba6cdb5b..1f286fbc42 100644 --- a/eeschema/erc/erc_settings.h +++ b/eeschema/erc/erc_settings.h @@ -19,8 +19,7 @@ * with this program. If not, see . */ -#ifndef _ERC_SETTINGS_H -#define _ERC_SETTINGS_H +#pragma once #include #include @@ -250,6 +249,11 @@ public: m_severities( 0 ) { } + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + SHEETLIST_ERC_ITEMS_PROVIDER( const SHEETLIST_ERC_ITEMS_PROVIDER& ) = delete; + SHEETLIST_ERC_ITEMS_PROVIDER& operator=( const SHEETLIST_ERC_ITEMS_PROVIDER& ) = delete; + void SetSeverities( int aSeverities ) override; int GetCount( int aSeverity = -1 ) const override; @@ -265,5 +269,3 @@ private: void visitMarkers( std::function aVisitor ) const; }; - -#endif // _ERC_SETTINGS_H diff --git a/eeschema/sch_rule_area.h b/eeschema/sch_rule_area.h index 3d5cbaf240..a7cfaedffd 100644 --- a/eeschema/sch_rule_area.h +++ b/eeschema/sch_rule_area.h @@ -137,11 +137,11 @@ protected: bool m_excludedFromBoard; bool m_DNP; ///< True if symbol is set to 'Do Not Populate'. - /// All #SCH_ITEM objects currently contained or intersecting the rule area. + /// All #SCH_ITEM objects currently contained or intersecting the rule area. No ownership. std::unordered_set m_items; std::unordered_set m_itemIDs; - /// All #SCH_DIRECTIVE_LABEL objectss attached to the rule area border. + /// All #SCH_DIRECTIVE_LABEL objects attached to the rule area border. No ownership. std::unordered_set m_directives; std::unordered_set m_directiveIDs; diff --git a/eeschema/sim/sim_lib_mgr.h b/eeschema/sim/sim_lib_mgr.h index c95a738625..7e3be7c6ac 100644 --- a/eeschema/sim/sim_lib_mgr.h +++ b/eeschema/sim/sim_lib_mgr.h @@ -22,8 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef SIM_LIB_MGR_H -#define SIM_LIB_MGR_H +#pragma once #include #include @@ -84,12 +83,10 @@ public: REPORTER& aReporter ); private: - std::vector m_embeddedFilesStack; - const PROJECT* m_project; + std::vector m_embeddedFilesStack; // no ownership + const PROJECT* m_project; // no ownership bool m_forceFullParse; std::map> m_libraries; std::vector> m_models; }; - -#endif // SIM_LIB_MGR_H diff --git a/include/libeval_compiler/libeval_compiler.h b/include/libeval_compiler/libeval_compiler.h index ce06551c5d..905b8b5073 100644 --- a/include/libeval_compiler/libeval_compiler.h +++ b/include/libeval_compiler/libeval_compiler.h @@ -18,8 +18,7 @@ along with this program. If not, see . */ -#ifndef __LIBEVAL_COMPILER_H -#define __LIBEVAL_COMPILER_H +#pragma once #include #include @@ -188,7 +187,7 @@ public: virtual double Convert( const wxString& aString, int unitType ) const { return 0.0; - }; + } }; @@ -202,7 +201,7 @@ public: m_isDeferredDbl( false ), m_isDeferredStr( false ), m_units( EDA_UNITS::UNSCALED ) - {}; + {} VALUE( const wxString& aStr, bool aIsWildcard = false ) : m_type( VT_STRING ), @@ -212,7 +211,7 @@ public: m_isDeferredDbl( false ), m_isDeferredStr( false ), m_units( EDA_UNITS::UNSCALED ) - {}; + {} VALUE( const double aVal ) : m_type( VT_NUMERIC ), @@ -221,7 +220,7 @@ public: m_isDeferredDbl( false ), m_isDeferredStr( false ), m_units( EDA_UNITS::UNSCALED ) - {}; + {} static VALUE* MakeNullValue() { @@ -230,8 +229,7 @@ public: return v; } - virtual ~VALUE() - {}; + virtual ~VALUE() = default; virtual double AsDouble() const { @@ -321,8 +319,10 @@ private: class KICOMMON_API VAR_REF { public: - VAR_REF() {}; - virtual ~VAR_REF() {}; + VAR_REF() + {} + + virtual ~VAR_REF() = default; virtual VAR_TYPE_T GetType() const = 0; virtual VALUE* GetValue( CONTEXT* aCtx ) = 0; @@ -333,8 +333,8 @@ class KICOMMON_API CONTEXT { public: CONTEXT() : - m_stack(), - m_stackPtr( 0 ) + m_stack(), + m_stackPtr( 0 ) { m_ownedValues.reserve( 20 ); } @@ -342,11 +342,14 @@ public: virtual ~CONTEXT() { for( VALUE* v : m_ownedValues ) - { delete v; - } } + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + CONTEXT( const CONTEXT& ) = delete; + CONTEXT& operator=( const CONTEXT& ) = delete; + VALUE* AllocValue() { m_ownedValues.emplace_back( new VALUE ); @@ -401,8 +404,16 @@ private: class KICOMMON_API UCODE { public: + UCODE() + {} + virtual ~UCODE(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + UCODE( const UCODE& ) = delete; + UCODE& operator=( const UCODE& ) = delete; + void AddOp( UOP* uop ) { m_ucode.push_back(uop); @@ -414,15 +425,14 @@ public: virtual std::unique_ptr CreateVarRef( const wxString& var, const wxString& field ) { return nullptr; - }; + } virtual FUNC_CALL_REF CreateFuncCall( const wxString& name ) { return nullptr; - }; + } protected: - std::vector m_ucode; }; @@ -434,24 +444,22 @@ public: m_op( op ), m_ref(nullptr), m_value( std::move( value ) ) - {}; + {} UOP( int op, std::unique_ptr vref ) : m_op( op ), m_ref( std::move( vref ) ), m_value(nullptr) - {}; + {} UOP( int op, FUNC_CALL_REF func, std::unique_ptr vref = nullptr ) : m_op( op ), m_func( std::move( func ) ), m_ref( std::move( vref ) ), m_value(nullptr) - {}; + {} - ~UOP() - { - } + virtual ~UOP() = default; void Exec( CONTEXT* ctx ); @@ -522,6 +530,11 @@ public: COMPILER(); virtual ~COMPILER(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + COMPILER( const COMPILER& ) = delete; + COMPILER& operator=( const COMPILER& ) = delete; + /* * clear() should be invoked by the client if a new input string is to be processed. It * will reset the parser. User defined variables are retained. @@ -596,4 +609,3 @@ protected: } // namespace LIBEVAL -#endif /* LIBEVAL_COMPILER_H_ */ diff --git a/include/rc_item.h b/include/rc_item.h index d5a3ee2a0d..d6634ddaa0 100644 --- a/include/rc_item.h +++ b/include/rc_item.h @@ -219,6 +219,11 @@ public: delete child; } + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + RC_TREE_NODE( const RC_TREE_NODE& ) = delete; + RC_TREE_NODE& operator=( const RC_TREE_NODE& ) = delete; + NODE_TYPE m_Type; std::shared_ptr m_RcItem; @@ -248,6 +253,11 @@ public: ~RC_TREE_MODEL(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + RC_TREE_MODEL( const RC_TREE_MODEL& ) = delete; + RC_TREE_MODEL& operator=( const RC_TREE_MODEL& ) = delete; + void Update( std::shared_ptr aProvider, int aSeverities ); void ExpandAll(); diff --git a/include/settings/json_settings.h b/include/settings/json_settings.h index 5281d9f0eb..6daee03667 100644 --- a/include/settings/json_settings.h +++ b/include/settings/json_settings.h @@ -78,6 +78,11 @@ public: virtual ~JSON_SETTINGS(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + JSON_SETTINGS( const JSON_SETTINGS& ) = delete; + JSON_SETTINGS& operator=( const JSON_SETTINGS& ) = delete; + wxString GetFilename() const { return m_filename; } wxString GetFullFilename() const; diff --git a/include/tool/action_toolbar.h b/include/tool/action_toolbar.h index f518343cd5..b30aa7ad82 100644 --- a/include/tool/action_toolbar.h +++ b/include/tool/action_toolbar.h @@ -103,7 +103,7 @@ protected: ///< The default action to display on the toolbar item const TOOL_ACTION* m_defaultAction; - ///< The actions that compose the group + ///< The actions that compose the group. Non-owning. std::vector m_actions; }; diff --git a/include/undo_redo_container.h b/include/undo_redo_container.h index 2560df281a..4f1ceeeeb1 100644 --- a/include/undo_redo_container.h +++ b/include/undo_redo_container.h @@ -292,6 +292,11 @@ public: UNDO_REDO_CONTAINER(); ~UNDO_REDO_CONTAINER(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + UNDO_REDO_CONTAINER( const UNDO_REDO_CONTAINER& ) = delete; + UNDO_REDO_CONTAINER& operator=( const UNDO_REDO_CONTAINER& ) = delete; + void PushCommand( PICKED_ITEMS_LIST* aCommand ); PICKED_ITEMS_LIST* PopCommand(); diff --git a/include/view/view.h b/include/view/view.h index d3d437530a..3841bad27f 100644 --- a/include/view/view.h +++ b/include/view/view.h @@ -24,8 +24,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef __VIEW_H -#define __VIEW_H +#pragma once #include #include @@ -73,6 +72,11 @@ public: VIEW(); virtual ~VIEW(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + VIEW( const VIEW& ) = delete; + VIEW& operator=( const VIEW& ) = delete; + /** * Nasty hack, invoked by the destructor of VIEW_ITEM to auto-remove the item * from the owning VIEW if there is any. @@ -768,10 +772,6 @@ protected: } }; - - - VIEW( const VIEW& ) = delete; - /// Redraw contents within rectangle \a aRect. void redrawRect( const BOX2I& aRect ); @@ -856,7 +856,7 @@ protected: struct UPDATE_DEPTH_VISITOR; std::unique_ptr m_preview; - std::vector m_ownedItems; + std::vector m_ownedItems; /// Whether to use rendering order modifier or not. bool m_enableOrderModifier; @@ -904,4 +904,3 @@ protected: }; } // namespace KIGFX -#endif diff --git a/include/view/view_group.h b/include/view/view_group.h index 61dd1a2b1d..c234d73fe8 100644 --- a/include/view/view_group.h +++ b/include/view/view_group.h @@ -25,12 +25,7 @@ * */ -/** - * @file view_group.h - */ - -#ifndef VIEW_GROUP_H_ -#define VIEW_GROUP_H_ +#pragma once #include #include @@ -50,6 +45,11 @@ public: VIEW_GROUP( VIEW* aView = nullptr ); virtual ~VIEW_GROUP(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + VIEW_GROUP( const VIEW_GROUP& ) = delete; + VIEW_GROUP& operator=( const VIEW_GROUP& ) = delete; + wxString GetClass() const override; /** @@ -108,9 +108,7 @@ protected: protected: int m_layer; - std::vector m_groupItems; + std::vector m_groupItems; // No ownership. }; } // namespace KIGFX - -#endif // VIEW_GROUP_H_ diff --git a/include/view/view_overlay.h b/include/view/view_overlay.h index fdfc220f6e..1310847057 100644 --- a/include/view/view_overlay.h +++ b/include/view/view_overlay.h @@ -24,12 +24,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef __VIEW_OVERLAY_H -#define __VIEW_OVERLAY_H +#pragma once #include #include - #include #include @@ -48,6 +46,11 @@ public: VIEW_OVERLAY(); virtual ~VIEW_OVERLAY(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + VIEW_OVERLAY( const VIEW_OVERLAY& ) = delete; + VIEW_OVERLAY& operator=( const VIEW_OVERLAY& ) = delete; + wxString GetClass() const override; struct COMMAND; @@ -109,13 +112,11 @@ public: private: void releaseCommands(); - COLOR4D m_strokeColor; - COLOR4D m_fillColor; - +private: + COLOR4D m_strokeColor; + COLOR4D m_fillColor; std::vector m_commands; }; } // namespace KIGFX - -#endif diff --git a/include/widgets/grid_text_button_helpers.h b/include/widgets/grid_text_button_helpers.h index 24032b7642..8ffec42a57 100644 --- a/include/widgets/grid_text_button_helpers.h +++ b/include/widgets/grid_text_button_helpers.h @@ -135,8 +135,8 @@ public: protected: DIALOG_SHIM* m_dlg; - SEARCH_STACK* m_searchStack; - std::vector m_filesStack; + SEARCH_STACK* m_searchStack; // No ownership. + std::vector m_filesStack; // No ownership. }; diff --git a/include/widgets/search_pane.h b/include/widgets/search_pane.h index 9d0687dd43..8853a449c2 100644 --- a/include/widgets/search_pane.h +++ b/include/widgets/search_pane.h @@ -68,6 +68,11 @@ public: SEARCH_PANE( EDA_DRAW_FRAME* aFrame ); virtual ~SEARCH_PANE(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + SEARCH_PANE( const SEARCH_PANE& ) = delete; + SEARCH_PANE& operator=( const SEARCH_PANE& ) = delete; + void AddSearcher( SEARCH_HANDLER* aHandler ); void OnSearchTextEntry( wxCommandEvent& aEvent ) override; void OnNotebookPageChanged( wxBookCtrlEvent& aEvent ) override; @@ -84,8 +89,8 @@ protected: void OnClosed( wxAuiManagerEvent& aEvent ); private: - std::vector m_handlers; - std::vector m_tabs; + std::vector m_handlers; // We own these. + std::vector m_tabs; // No ownership. wxString m_lastQuery; EDA_DRAW_FRAME* m_frame; ACTION_MENU* m_menu; diff --git a/pcbnew/drc/drc_engine.h b/pcbnew/drc/drc_engine.h index e9eda5a9d3..d9069fe09a 100644 --- a/pcbnew/drc/drc_engine.h +++ b/pcbnew/drc/drc_engine.h @@ -91,6 +91,11 @@ public: DRC_ENGINE( BOARD* aBoard = nullptr, BOARD_DESIGN_SETTINGS* aSettings = nullptr ); virtual ~DRC_ENGINE(); + // We own several lists of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + DRC_ENGINE( const DRC_ENGINE& ) = delete; + DRC_ENGINE& operator=( const DRC_ENGINE& ) = delete; + void SetBoard( BOARD* aBoard ) { m_board = aBoard; } BOARD* GetBoard() const { return m_board; } diff --git a/pcbnew/drc/drc_item.h b/pcbnew/drc/drc_item.h index ca116b398e..45b4148939 100644 --- a/pcbnew/drc/drc_item.h +++ b/pcbnew/drc/drc_item.h @@ -278,6 +278,11 @@ public: m_markerTypes.push_back( otherMarkerType ); } + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + DRC_ITEMS_PROVIDER( const DRC_ITEMS_PROVIDER& ) = delete; + DRC_ITEMS_PROVIDER& operator=( const DRC_ITEMS_PROVIDER& ) = delete; + void SetSeverities( int aSeverities ) override; int GetCount( int aSeverity = -1 ) const override; diff --git a/pcbnew/pcb_table.h b/pcbnew/pcb_table.h index 8228d9cab2..2b4dcb4a21 100644 --- a/pcbnew/pcb_table.h +++ b/pcbnew/pcb_table.h @@ -39,6 +39,9 @@ public: ~PCB_TABLE(); + // If implemented, would need to copy m_cells list. + PCB_TABLE& operator=( const PCB_TABLE& ) = delete; + static inline bool ClassOf( const EDA_ITEM* aItem ) { return aItem && PCB_TABLE_T == aItem->Type(); diff --git a/pcbnew/widgets/appearance_controls.h b/pcbnew/widgets/appearance_controls.h index df329c5df0..31ea96502e 100644 --- a/pcbnew/widgets/appearance_controls.h +++ b/pcbnew/widgets/appearance_controls.h @@ -202,6 +202,11 @@ public: APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, bool aFpEditor = false ); ~APPEARANCE_CONTROLS(); + // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that + // will only land us in trouble. + APPEARANCE_CONTROLS( const APPEARANCE_CONTROLS& ) = delete; + APPEARANCE_CONTROLS& operator=( const APPEARANCE_CONTROLS& ) = delete; + wxSize GetBestSize() const; ///< Update the panel contents from the application and board models.