diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 2866248b5b..a043204d4d 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -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( 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( libPin, this ) ) ).get(); } m_pinMap[ libPin ] = pin;