From 9fae110031b33a3defbf297c2306568d9c44ad99 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 29 Aug 2023 12:29:30 +0100 Subject: [PATCH] Make sure copied SCH_PINs get their LIB_PIN pointers set. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15536 --- eeschema/sch_symbol.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 728e2b4acc..f1239b7fe6 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -190,8 +190,12 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) : m_pins.clear(); + // Copy (and re-parent) the pins for( const std::unique_ptr& pin : aSymbol.m_pins ) - m_pins.emplace_back( std::make_unique( this, pin->GetNumber(), pin->GetAlt() ) ); + { + m_pins.emplace_back( std::make_unique( *pin ) ); + m_pins.back()->SetParent( this ); + } m_fieldsAutoplaced = aSymbol.m_fieldsAutoplaced; m_schLibSymbolName = aSymbol.m_schLibSymbolName;