Re-parent items being copied from the clipboard.

Their original parent might have been freed by now if they came
from a different symbol.

Fixes: lp:1815525
* https://bugs.launchpad.net/kicad/+bug/1815525
This commit is contained in:
Jeff Young 2019-02-27 19:09:00 +00:00
parent f494a24404
commit 22229fbba4
1 changed files with 3 additions and 1 deletions

View File

@ -475,13 +475,15 @@ void LIB_EDIT_FRAME::InitBlockPasteInfos()
// (only the copy, the new instances will be appended to the part once the items are placed)
block.GetItems().CopyList( m_clipboard.GetItems() );
// Set block items to the current unit & DeMorgan variant
// Reparent block items and set their current unit & DeMorgan variant
for( size_t i = 0; i < m_clipboard.GetItems().GetCount(); ++i )
{
LIB_ITEM* item = dynamic_cast<LIB_ITEM*>( m_clipboard.GetItem( i ) );
if( item )
{
item->SetParent( GetCurPart() );
item->SetUnit( m_unit );
item->SetConvert( m_convert );
}