Browse Source

Fix group ownership issue.

pull/18/head
Jeff Young 6 months ago
parent
commit
fc969ae501
  1. 13
      pcbnew/pcb_group.cpp

13
pcbnew/pcb_group.cpp

@ -268,17 +268,22 @@ void PCB_GROUP::swapData( BOARD_ITEM* aImage )
std::swap( *this, *image );
RunOnChildren(
// 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( this );
child->SetParentGroup( image );
},
RECURSE_MODE::NO_RECURSE );
image->RunOnChildren(
RunOnChildren(
[&]( BOARD_ITEM* child )
{
child->SetParentGroup( image );
child->SetParentGroup( this );
},
RECURSE_MODE::NO_RECURSE );
}

Loading…
Cancel
Save