Remove added items from group on revert.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16562
This commit is contained in:
Jeff Young 2024-01-10 17:35:56 +00:00
parent 9038f80543
commit e55ec85e19
1 changed files with 8 additions and 0 deletions

View File

@ -614,6 +614,14 @@ void BOARD_COMMIT::Revert()
switch( changeType )
{
case CHT_ADD:
// Items are auto-added to the parent group by BOARD_ITEM::Duplicate(), not when
// the commit is pushed.
if( PCB_GROUP* parentGroup = boardItem->GetParentGroup() )
{
if( GetStatus( parentGroup ) == 0 )
parentGroup->RemoveItem( boardItem );
}
if( !( changeFlags & CHT_DONE ) )
break;