Fix QA error.

When updating the symbol, we clear the libpins, so remove it to avoid
getting garbage while updating
This commit is contained in:
Seth Hillbrand 2025-08-22 12:53:43 -07:00
parent 679ee7e4d1
commit a77e1027d6
2 changed files with 7 additions and 3 deletions

View File

@ -254,6 +254,12 @@ void SCH_SYMBOL::SetLibSymbol( LIB_SYMBOL* aLibSymbol )
wxCHECK2( !aLibSymbol || aLibSymbol->IsRoot(), aLibSymbol = nullptr );
m_part.reset( aLibSymbol );
// We've just reset the library symbol, so the lib_pins, which were just
// pointers to the old symbol, need to be cleared.
for( auto& pin : m_pins )
pin->SetLibPin( nullptr );
UpdatePins();
}
@ -302,7 +308,6 @@ void SCH_SYMBOL::UpdatePins()
if( !pin->GetAlt().IsEmpty() )
{
altPinMap[ pin->GetNumber() ] = pin->GetAlt();
auto altDefIt = pin->GetAlternates().find( pin->GetAlt() );
if( altDefIt != pin->GetAlternates().end() )

View File

@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE( AlternatePinRenameUpdates )
alt.m_Type = ELECTRICAL_PINTYPE::PT_INPUT;
m_lib_pin->GetAlternates()[ wxS( "ALT1" ) ] = alt;
m_parent_symbol->UpdatePins();
m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
m_sch_pin = m_parent_symbol->GetPins()[0];
m_sch_pin->SetAlt( wxS( "ALT1" ) );
@ -207,7 +207,6 @@ BOOST_AUTO_TEST_CASE( AlternatePinRenameUpdates )
m_lib_pin->GetAlternates()[ wxS( "ALT1_NEW" ) ] = altNew;
m_parent_symbol->SetLibSymbol( m_parent_part->Flatten().release() );
m_parent_symbol->UpdatePins();
SCH_PIN* updatedPin = m_parent_symbol->GetPins()[0];