Set pinmap after updating pins

When duplicating and existing symbol, we must set the pins before
setting the lib symbol as the lib symbol will generate a pin map that
will be broken by the shift to new pins

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15728
This commit is contained in:
Seth Hillbrand 2023-09-26 11:30:02 -07:00
parent 54171ec030
commit 12ebb2bbfa
1 changed files with 4 additions and 5 deletions

View File

@ -174,9 +174,6 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
m_excludedFromBoard = aSymbol.m_excludedFromBoard;
m_DNP = aSymbol.m_DNP;
if( aSymbol.m_part )
SetLibSymbol( new LIB_SYMBOL( *aSymbol.m_part ) );
const_cast<KIID&>( m_Uuid ) = aSymbol.m_Uuid;
m_transform = aSymbol.m_transform;
@ -197,6 +194,9 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
m_pins.back()->SetParent( this );
}
if( aSymbol.m_part )
SetLibSymbol( new LIB_SYMBOL( *aSymbol.m_part ) );
m_fieldsAutoplaced = aSymbol.m_fieldsAutoplaced;
m_schLibSymbolName = aSymbol.m_schLibSymbolName;
}
@ -407,8 +407,7 @@ void SCH_SYMBOL::UpdatePins()
else
{
// This is a pin that was not found in the symbol, so create a new one.
pin = new SCH_PIN( libPin, this );
m_pins.emplace_back( pin );
pin = m_pins.emplace_back( std::make_unique<SCH_PIN>( SCH_PIN( libPin, this ) ) ).get();
}
m_pinMap[ libPin ] = pin;