diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 933d6214a0..2bf41cadd1 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -445,13 +445,11 @@ void SCH_COMPONENT::UpdatePins( SCH_SHEET_PATH* aSheet ) m_pins.emplace_back( SCH_PIN( libPin, this ) ); } - m_pinMap[ libPin ] = &m_pins[ i ]; - - if( aSheet ) - m_pins[ i ].InitializeConnection( *aSheet ); - ++i; } + + for( SCH_PIN& pin : m_pins ) + m_pinMap[ pin.GetLibPin() ] = &pin; } } diff --git a/eeschema/sch_item_struct.cpp b/eeschema/sch_item_struct.cpp index 399889d34d..8a83db6973 100644 --- a/eeschema/sch_item_struct.cpp +++ b/eeschema/sch_item_struct.cpp @@ -68,6 +68,9 @@ SCH_ITEM::~SCH_ITEM() // are owned by the sheet object container. if( !m_connections.empty() ) m_connections.clear(); + + for( const auto& it : m_connection_map ) + delete it.second; }