Fix two unrelated bugs in ungroup.

1) Don't double-remove the members from the group.
2) Don't auto-recurse BOARD_COMMIT::Stage for non-modify
changes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16419
This commit is contained in:
Jeff Young 2023-12-21 22:34:21 +00:00
parent 1ca82035ae
commit 1f627a3a75
2 changed files with 9 additions and 7 deletions

View File

@ -78,13 +78,16 @@ COMMIT& BOARD_COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCRE
// Many operations (move, rotate, etc.) are applied directly to a group's children, so they
// must be staged as well.
if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( aItem ) )
if( aChangeType == CHT_MODIFY )
{
group->RunOnChildren(
[&]( BOARD_ITEM* child )
{
Stage( child, aChangeType );
} );
if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( aItem ) )
{
group->RunOnChildren(
[&]( BOARD_ITEM* child )
{
Stage( child, aChangeType );
} );
}
}
return COMMIT::Stage( aItem, aChangeType );

View File

@ -311,7 +311,6 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
toSelect.push_back( member );
}
group->GetItems().clear();
group->SetSelected();
commit.Remove( group );
}