Eeschema: fix symbol cache library look up bug.
Use an underscore character instead of a semicolon between the library
ID library nickname and symbol name in library ID search strings when
looking up symbols in the cache library since that is how they are saved
when creating the cache library. This fixes rescuing missing symbols
from the cache when they have been removed from the original library and
preventing a broken symbol link indicator from being shown when a symbol
is removed from the library.
Add some defensive testing to make sure the library passed to function
SchGetLibPart() is actually the cache library.
(cherry picked from commit f6d7ef367d
)
This commit is contained in:
parent
a6a39cb842
commit
d79e598bf8
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2015-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2015-2020 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -45,17 +45,22 @@
|
|||
LIB_ALIAS* SchGetLibAlias( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
|
||||
wxWindow* aParent, bool aShowErrorMsg )
|
||||
{
|
||||
// wxCHECK_MSG( aLibId.IsValid(), NULL, "LIB_ID is not valid." );
|
||||
wxCHECK_MSG( aLibTable, NULL, "Invalid symbol library table." );
|
||||
wxCHECK_MSG( aLibTable, nullptr, "Invalid symbol library table." );
|
||||
|
||||
LIB_ALIAS* alias = NULL;
|
||||
LIB_PART* symbol = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
alias = aLibTable->LoadSymbol( aLibId );
|
||||
|
||||
if( !alias && aCacheLib )
|
||||
alias = aCacheLib->FindAlias( aLibId );
|
||||
if( !symbol && aCacheLib )
|
||||
{
|
||||
wxCHECK_MSG( aCacheLib->IsCache(), nullptr, "Invalid cache library." );
|
||||
|
||||
wxString cacheName = aLibId.GetLibNickname().wx_str();
|
||||
cacheName += "_" + aLibId.GetLibItemName();
|
||||
symbol = aCacheLib->FindPart( cacheName );
|
||||
}
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue