From 45fb0107a0e122a1d90a52e1a643a91923422ec6 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 11 Sep 2022 23:15:54 +0100 Subject: [PATCH] Copy field properly. Offset for new parent, and set parent property. Fixes https://gitlab.com/kicad/code/kicad/issues/12376 --- eeschema/dialogs/dialog_symbol_properties.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index ec1a674c53..25b05ba8f7 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -751,8 +751,14 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow() } else { - SCH_FIELD* newField = otherUnit->AddField( m_fields->at( ii ) ); - const_cast( newField->m_Uuid ) = KIID(); + SCH_FIELD newField( m_fields->at( ii ) ); + const_cast( newField.m_Uuid ) = KIID(); + + newField.Offset( -m_symbol->GetPosition() ); + newField.Offset( otherUnit->GetPosition() ); + + newField.SetParent( otherUnit ); + otherUnit->AddField( newField ); } }