Swap pins for undo.

Fixes https://gitlab.com/kicad/code/kicad/issues/14100

(cherry picked from commit c266913ec7)
This commit is contained in:
Jeff Young 2023-03-14 11:48:00 +00:00
parent 9995b8714b
commit b2679b7648
1 changed files with 8 additions and 0 deletions

View File

@ -1095,6 +1095,14 @@ void SCH_SYMBOL::SwapData( SCH_ITEM* aItem )
std::swap( m_lib_id, symbol->m_lib_id ); std::swap( m_lib_id, symbol->m_lib_id );
m_pins.swap( symbol->m_pins ); // std::vector's swap()
for( std::unique_ptr<SCH_PIN>& pin : symbol->m_pins )
pin->SetParent( symbol );
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
pin->SetParent( this );
LIB_SYMBOL* libSymbol = symbol->m_part.release(); LIB_SYMBOL* libSymbol = symbol->m_part.release();
symbol->m_part = std::move( m_part ); symbol->m_part = std::move( m_part );
symbol->UpdatePins(); symbol->UpdatePins();