Copy field properly.

Offset for new parent, and set parent property.

Fixes https://gitlab.com/kicad/code/kicad/issues/12376
This commit is contained in:
Jeff Young 2022-09-11 23:15:54 +01:00
parent fb48bef49f
commit 45fb0107a0
1 changed files with 8 additions and 2 deletions

View File

@ -751,8 +751,14 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
} }
else else
{ {
SCH_FIELD* newField = otherUnit->AddField( m_fields->at( ii ) ); SCH_FIELD newField( m_fields->at( ii ) );
const_cast<KIID&>( newField->m_Uuid ) = KIID(); const_cast<KIID&>( newField.m_Uuid ) = KIID();
newField.Offset( -m_symbol->GetPosition() );
newField.Offset( otherUnit->GetPosition() );
newField.SetParent( otherUnit );
otherUnit->AddField( newField );
} }
} }