Escape names when migrating legacy libraries.

Fixes https://gitlab.com/kicad/code/kicad/issues/8951
This commit is contained in:
Jeff Young 2021-08-12 22:07:30 +01:00
parent 98d0ce00ee
commit fbb3f4b58d
1 changed files with 5 additions and 1 deletions

View File

@ -813,7 +813,7 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxStri
SCH_PLUGIN::SCH_PLUGIN_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) ); SCH_PLUGIN::SCH_PLUGIN_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
std::vector<LIB_SYMBOL*> symbols; std::vector<LIB_SYMBOL*> symbols;
std::vector<LIB_SYMBOL*> newSymbols; std::vector<LIB_SYMBOL*> newSymbols;
std::map<LIB_SYMBOL*, LIB_SYMBOL*> symbolMap; std::map<LIB_SYMBOL*, LIB_SYMBOL*> symbolMap;
try try
{ {
@ -834,6 +834,8 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxStri
if( symbol->IsAlias() ) if( symbol->IsAlias() )
continue; continue;
symbol->SetName( EscapeString( symbol->GetName(), CTX_LIBID ) );
newSymbols.push_back( new LIB_SYMBOL( *symbol ) ); newSymbols.push_back( new LIB_SYMBOL( *symbol ) );
symbolMap[symbol] = newSymbols.back(); symbolMap[symbol] = newSymbols.back();
} }
@ -844,6 +846,8 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxStri
if( !symbol->IsAlias() ) if( !symbol->IsAlias() )
continue; continue;
symbol->SetName( EscapeString( symbol->GetName(), CTX_LIBID ) );
newSymbols.push_back( new LIB_SYMBOL( *symbol ) ); newSymbols.push_back( new LIB_SYMBOL( *symbol ) );
newSymbols.back()->SetParent( symbolMap[ symbol->GetParent().lock().get() ] ); newSymbols.back()->SetParent( symbolMap[ symbol->GetParent().lock().get() ] );
} }