Don't leave temp footprints attached to a board.

This commit is contained in:
Jeff Young 2023-01-18 00:40:14 +00:00
parent f35a02d57a
commit f45d44a639
3 changed files with 14 additions and 1 deletions

View File

@ -795,6 +795,8 @@ BOX2I FOOTPRINT::GetFpPadsLocalBbox() const
for( PAD* pad : dummy.Pads() )
bbox.Merge( pad->GetBoundingBox() );
dummy.SetParent( nullptr );
return bbox;
}

View File

@ -94,6 +94,8 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) );
Format( static_cast<BOARD_ITEM*>( &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
{

View File

@ -44,6 +44,8 @@
#include <kiway.h>
#include <drc/drc_item.h>
#include <memory>
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<FOOTPRINT>( *m_frame->GetBoard()->GetFirstFootprint() );
m_copiedFootprint->SetParent( nullptr );
}
else
{
m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) );
}
if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
DeleteFootprint( aEvent );