diff --git a/include/class_board_item.h b/include/class_board_item.h index 131cf2240c..34c275c14f 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -40,6 +40,7 @@ #define FMT_ANGLE BOARD_ITEM::FormatAngle class BOARD; +class BOARD_ITEM_CONTAINER; class EDA_DRAW_PANEL; @@ -122,7 +123,7 @@ public: BOARD_ITEM* Next() const { return static_cast( Pnext ); } BOARD_ITEM* Back() const { return static_cast( Pback ); } - BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; } + BOARD_ITEM_CONTAINER* GetParent() const { return (BOARD_ITEM_CONTAINER*) m_Parent; } /** * Function GetLayer diff --git a/pcbnew/class_board_item.cpp b/pcbnew/class_board_item.cpp index 2f548bfb0e..6cacf21f55 100644 --- a/pcbnew/class_board_item.cpp +++ b/pcbnew/class_board_item.cpp @@ -251,10 +251,10 @@ int BOARD_ITEM::getNextNumberInSequence( const std::set& aSeq, bool aFillSe void BOARD_ITEM::DeleteStructure() { - auto brd = GetBoard(); + auto parent = GetParent(); - if( brd ) - brd->Remove( this ); + if( parent && GetList() ) + parent->Remove( this ); delete this; } diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index 187aab640f..d50ef55e33 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -111,14 +111,12 @@ public: BITMAP_DEF GetMenuImage() const override { return drc_xpm; } - ///> @copydoc VIEW_ITEM::ViewBBox() - virtual const BOX2I ViewBBox() const override + const BOX2I ViewBBox() const override { - return GetParent()->ViewBBox(); + return m_item->ViewBBox(); } - ///> @copydoc VIEW_ITEM::ViewGetLayers() - virtual void ViewGetLayers( int aLayers[], int& aCount ) const override; + void ViewGetLayers( int aLayers[], int& aCount ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }