Fix schematic editor crash when updating symbols.
Some how symbol names that still have escaped '/' character get mixed with symbol names that have '/' characters now that it is no longer an invalid LIB_ID character. This was causing derived symbols to loose the link to the parent symbol. This fix replaces any instances of "{slash}" with "/" to convert symbol names to the proper escaping. Thanks to JP for the inspiration for the fix. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15715
This commit is contained in:
parent
c73c2360a4
commit
2f51d22b3a
|
@ -224,6 +224,11 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::parseLibSymbol( LIB_SYMBOL_MAP& aSymbolLibMap )
|
|||
|
||||
name = FromUTF8();
|
||||
|
||||
// Some symbol LIB_IDs have the '/' character escaped which can break derived symbol links.
|
||||
// The '/' character is no longer an illegal LIB_ID character so it doesn't need to be
|
||||
// escaped.
|
||||
name.Replace( wxS( "{slash}" ), wxT( "/" ) );
|
||||
|
||||
LIB_ID id;
|
||||
int bad_pos = id.Parse( name );
|
||||
|
||||
|
@ -305,6 +310,12 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::parseLibSymbol( LIB_SYMBOL_MAP& aSymbolLibMap )
|
|||
}
|
||||
|
||||
name = FromUTF8();
|
||||
|
||||
// Some symbol LIB_IDs have the '/' character escaped which can break derived
|
||||
// symbol links. The '/' character is no longer an illegal LIB_ID character so
|
||||
// it doesn't need to be escaped.
|
||||
name.Replace( wxS( "{slash}" ), wxT( "/" ) );
|
||||
|
||||
auto it = aSymbolLibMap.find( name );
|
||||
|
||||
if( it == aSymbolLibMap.end() )
|
||||
|
@ -330,6 +341,11 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::parseLibSymbol( LIB_SYMBOL_MAP& aSymbolLibMap )
|
|||
|
||||
name = FromUTF8();
|
||||
|
||||
// Some symbol LIB_IDs have the '/' character escaped which can break derived
|
||||
// symbol links. The '/' character is no longer an illegal LIB_ID character so
|
||||
// it doesn't need to be escaped.
|
||||
name.Replace( wxS( "{slash}" ), wxT( "/" ) );
|
||||
|
||||
if( !name.StartsWith( m_symbolName ) )
|
||||
{
|
||||
error.Printf( _( "Invalid symbol unit name prefix %s" ), name.c_str() );
|
||||
|
|
Loading…
Reference in New Issue