Make sure items are removed from groups when deleted.

Fixes https://gitlab.com/kicad/code/kicad/issues/7387
This commit is contained in:
Jeff Young 2021-02-02 11:57:48 +00:00
parent c98c7cf200
commit d261fa3792
3 changed files with 16 additions and 3 deletions

View File

@ -738,6 +738,9 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
wxFAIL_MSG( wxT( "BOARD::Remove() needs more ::Type() support" ) );
}
if( aBoardItem->GetParentGroup() )
aBoardItem->GetParentGroup()->RemoveItem( aBoardItem );
m_connectivity->Remove( aBoardItem );
if( aRemoveMode != REMOVE_MODE::BULK )
@ -2011,7 +2014,9 @@ wxString BOARD::GroupsSanityCheck( bool repair )
{
if( repair )
{
while( GroupsSanityCheckInternal( repair ) != wxEmptyString );
while( GroupsSanityCheckInternal( repair ) != wxEmptyString )
{};
return wxEmptyString;
}
return GroupsSanityCheckInternal( repair );

View File

@ -193,12 +193,14 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
switch( boardItem->Type() )
{
// Module items
// Footprint items
case PCB_PAD_T:
case PCB_FP_SHAPE_T:
case PCB_FP_TEXT_T:
case PCB_FP_ZONE_T:
// This level can only handle footprint children when editing footprints
// This level can only handle footprint children in the footprint editor as
// only in that case has the entire footprint (and all its children) already
// been saved for undo.
wxASSERT( m_isFootprintEditor );
if( boardItem->Type() == PCB_FP_TEXT_T )
@ -210,6 +212,9 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
break;
}
if( boardItem->GetParentGroup() )
boardItem->GetParentGroup()->RemoveItem( boardItem );
view->Remove( boardItem );
if( !( changeFlags & CHT_DONE ) )

View File

@ -562,6 +562,9 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode )
wxFAIL_MSG( msg );
}
}
if( aBoardItem->GetParentGroup() )
aBoardItem->GetParentGroup()->RemoveItem( aBoardItem );
}