Remove existing footprint when force-reloading

Needs to clear the existing footprint in ReloadFootprint prior to
loading the new one.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15040
This commit is contained in:
Seth Hillbrand 2023-06-26 17:03:03 -07:00
parent 2a940a5f70
commit f3122184df
2 changed files with 9 additions and 0 deletions

View File

@ -539,6 +539,8 @@ void FOOTPRINT_EDIT_FRAME::restoreLastFootprint()
void FOOTPRINT_EDIT_FRAME::ReloadFootprint( FOOTPRINT* aFootprint ) void FOOTPRINT_EDIT_FRAME::ReloadFootprint( FOOTPRINT* aFootprint )
{ {
GetBoard()->DeleteAllFootprints();
m_originalFootprintCopy.reset( static_cast<FOOTPRINT*>( aFootprint->Clone() ) ); m_originalFootprintCopy.reset( static_cast<FOOTPRINT*>( aFootprint->Clone() ) );
m_originalFootprintCopy->SetParent( nullptr ); m_originalFootprintCopy->SetParent( nullptr );

View File

@ -1248,7 +1248,14 @@ void PCB_BASE_FRAME::OnFpChangeDebounceTimer( wxTimerEvent& aEvent )
FOOTPRINT* newfp = tbl->FootprintLoad( nickname, fpname ); FOOTPRINT* newfp = tbl->FootprintLoad( nickname, fpname );
if( newfp ) if( newfp )
{
ReloadFootprint( newfp ); ReloadFootprint( newfp );
newfp->ClearAllNets();
GetCanvas()->UpdateColors();
GetCanvas()->DisplayBoard( GetBoard() );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
}
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {