diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index c049776d85..32e97af585 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -128,12 +128,19 @@ MODULE::MODULE( const MODULE& aModule ) : for( PCB_GROUP* group : aModule.Groups() ) { PCB_GROUP* newGroup = static_cast( group->Clone() ); + ptrMap[ group ] = newGroup; + Add( newGroup ); + } + + // Rebuild groups + for( PCB_GROUP* group : aModule.Groups() ) + { + PCB_GROUP* newGroup = static_cast( ptrMap[ group ] ); + const_cast*>( &newGroup->GetItems() )->clear(); for( BOARD_ITEM* member : group->GetItems() ) newGroup->AddItem( ptrMap[ member ] ); - - Add( newGroup ); } // Copy auxiliary data: 3D_Drawings info