diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 9f656fd451..6fc7a09825 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -795,6 +795,8 @@ BOX2I FOOTPRINT::GetFpPadsLocalBbox() const for( PAD* pad : dummy.Pads() ) bbox.Merge( pad->GetBoundingBox() ); + dummy.SetParent( nullptr ); + return bbox; } diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 2878bed481..2f762bf07a 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -94,6 +94,8 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) ); Format( static_cast( &newFootprint ) ); + + newFootprint.SetParent( nullptr ); } else if( isFootprintEditor ) { @@ -171,6 +173,8 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri partialFootprint.MoveAnchorPosition( moveVector ); Format( &partialFootprint, 0 ); + + partialFootprint.SetParent( nullptr ); } else { diff --git a/pcbnew/tools/footprint_editor_control.cpp b/pcbnew/tools/footprint_editor_control.cpp index b2f909e10e..f26a252fa5 100644 --- a/pcbnew/tools/footprint_editor_control.cpp +++ b/pcbnew/tools/footprint_editor_control.cpp @@ -44,6 +44,8 @@ #include #include +#include + FOOTPRINT_EDITOR_CONTROL::FOOTPRINT_EDITOR_CONTROL() : PCB_TOOL_BASE( "pcbnew.ModuleEditor" ), @@ -326,9 +328,14 @@ int FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint( const TOOL_EVENT& aEvent ) LIB_ID fpID = m_frame->GetTreeFPID(); if( fpID == m_frame->GetLoadedFPID() ) - m_copiedFootprint.reset( new FOOTPRINT( *m_frame->GetBoard()->GetFirstFootprint() ) ); + { + m_copiedFootprint = std::make_unique( *m_frame->GetBoard()->GetFirstFootprint() ); + m_copiedFootprint->SetParent( nullptr ); + } else + { m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) ); + } if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) ) DeleteFootprint( aEvent );