Symbol editor: fix assertion attempting to copy an inherited symbol.

Copying or cutting an symbol to the clipboard using the context menu
in the library tree requires a root symbol.  Inherited symbols must
be flattened in order to properly be added to a symbol library.

Fixes https://gitlab.com/kicad/code/kicad/issues/4901
This commit is contained in:
Wayne Stambaugh 2020-07-15 20:57:17 -04:00
parent 11ca21039a
commit 0ab8b9a2d9
1 changed files with 2 additions and 1 deletions

View File

@ -595,8 +595,9 @@ void LIB_EDIT_FRAME::CopyPartToClipboard()
if( !part )
return;
std::unique_ptr< LIB_PART> tmp = part->Flatten();
STRING_FORMATTER formatter;
SCH_SEXPR_PLUGIN::FormatPart( part, formatter );
SCH_SEXPR_PLUGIN::FormatPart( tmp.get(), formatter );
auto clipboard = wxTheClipboard;
wxClipboardLocker clipboardLock( clipboard );