mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Don't leak PCB_GROUP internals into BOARD_COMMIT.
(This also fixes a potential bug where the image group's children didn't get the image as a parent.)
This commit is contained in:
parent
c1b1c689ad
commit
199a7a34ea
@ -751,16 +751,6 @@ void BOARD_COMMIT::Revert()
|
||||
BOARD_ITEM* boardItemCopy = static_cast<BOARD_ITEM*>( entry.m_copy );
|
||||
boardItem->SwapItemData( boardItemCopy );
|
||||
|
||||
if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( boardItem ) )
|
||||
{
|
||||
group->RunOnChildren(
|
||||
[&]( BOARD_ITEM* child )
|
||||
{
|
||||
child->SetParentGroup( group );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
view->Add( boardItem );
|
||||
connectivity->Add( boardItem );
|
||||
itemsChanged.push_back( boardItem );
|
||||
|
@ -264,8 +264,23 @@ PCB_GROUP* PCB_GROUP::DeepDuplicate() const
|
||||
void PCB_GROUP::swapData( BOARD_ITEM* aImage )
|
||||
{
|
||||
assert( aImage->Type() == PCB_GROUP_T );
|
||||
PCB_GROUP* image = static_cast<PCB_GROUP*>( aImage );
|
||||
|
||||
std::swap( *( (PCB_GROUP*) this ), *( (PCB_GROUP*) aImage ) );
|
||||
std::swap( *this, *image );
|
||||
|
||||
RunOnChildren(
|
||||
[&]( BOARD_ITEM* child )
|
||||
{
|
||||
child->SetParentGroup( this );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
image->RunOnChildren(
|
||||
[&]( BOARD_ITEM* child )
|
||||
{
|
||||
child->SetParentGroup( image );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user