Fixed a crash on finishing line drawing in the legacy FP editor

Fixes: lp:1649597
* https://bugs.launchpad.net/kicad/+bug/1649597
This commit is contained in:
Maciej Suminski 2016-12-13 17:24:19 +01:00
parent b1e37ae1dc
commit 139521750b
3 changed files with 8 additions and 9 deletions

View File

@ -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<BOARD_ITEM*>( Pnext ); }
BOARD_ITEM* Back() const { return static_cast<BOARD_ITEM*>( Pback ); }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
BOARD_ITEM_CONTAINER* GetParent() const { return (BOARD_ITEM_CONTAINER*) m_Parent; }
/**
* Function GetLayer

View File

@ -251,10 +251,10 @@ int BOARD_ITEM::getNextNumberInSequence( const std::set<int>& 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;
}

View File

@ -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 ); }