Do not allow items to be parented to themselves.
There is code that walks up the parent chain that looks for the top most parent. If an object is parented to itself, this will create and infinite loop.
This commit is contained in:
@@ -88,6 +88,14 @@ EDA_ITEM* EDA_ITEM::findParent( KICAD_T aType ) const
|
||||
}
|
||||
|
||||
|
||||
void EDA_ITEM::SetParent( EDA_ITEM* aParent )
|
||||
{
|
||||
wxCHECK( aParent != this, /* void */ );
|
||||
|
||||
m_parent = aParent;
|
||||
}
|
||||
|
||||
|
||||
KIID EDA_ITEM::GetParentGroupId() const
|
||||
{
|
||||
if( EDA_GROUP* group = GetParentGroup() )
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public:
|
||||
inline KICAD_T Type() const { return m_structType; }
|
||||
|
||||
EDA_ITEM* GetParent() const { return m_parent; }
|
||||
virtual void SetParent( EDA_ITEM* aParent ) { m_parent = aParent; }
|
||||
virtual void SetParent( EDA_ITEM* aParent );
|
||||
|
||||
virtual void SetParentGroup( EDA_GROUP* aGroup ) { m_group = aGroup; }
|
||||
virtual EDA_GROUP* GetParentGroup() const { return m_group; }
|
||||
|
||||
Reference in New Issue
Block a user