mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Fix group ownership issue.
This commit is contained in:
parent
c528f3c605
commit
fc969ae501
@ -268,19 +268,24 @@ void PCB_GROUP::swapData( BOARD_ITEM* aImage )
|
||||
|
||||
std::swap( *this, *image );
|
||||
|
||||
RunOnChildren(
|
||||
[&]( BOARD_ITEM* child )
|
||||
{
|
||||
child->SetParentGroup( this );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
// A group doesn't own its children (they're owned by the board), so undo doesn't do a
|
||||
// deep clone when making an image. However, it's still safest to update the parentGroup
|
||||
// pointers of the group's children -- we just have to be careful to do it in the right
|
||||
// order in case any of the children are shared (ie: image first, "this" second so that
|
||||
// any shared children end up with "this").
|
||||
image->RunOnChildren(
|
||||
[&]( BOARD_ITEM* child )
|
||||
{
|
||||
child->SetParentGroup( image );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
RunOnChildren(
|
||||
[&]( BOARD_ITEM* child )
|
||||
{
|
||||
child->SetParentGroup( this );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user