diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 4aee25c4d7..450b790e7c 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -96,6 +96,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri Format( static_cast( &newFootprint ) ); newFootprint.SetParent( nullptr ); + newFootprint.SetParentGroup( nullptr ); } else if( isFootprintEditor ) { @@ -128,6 +129,10 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri if( PAD* pad = dyn_cast( clone ) ) pad->SetNetCode( 0 ); + // Don't copy group membership information for the 1st level objects being copied + // since the group they belong to isn't being copied. + clone->SetParentGroup( nullptr ); + // Add the pad to the new footprint before moving to ensure the local coords are // correct partialFootprint.Add( clone ); @@ -163,7 +168,10 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri // Now delete items, duplicated but not added: for( BOARD_ITEM* skp_item : skipped_items ) + { + skp_item->SetParentGroup( nullptr ); delete skp_item; + } } // Set the new relative internal local coordinates of copied items @@ -283,6 +291,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri } ); } + copy->SetParentGroup( nullptr ); delete copy; } }