Eeschema: fix broken project symbol rescue bug.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9111
This commit is contained in:
Wayne Stambaugh 2021-09-09 10:19:25 -04:00
parent bb2efa0649
commit 451f8eefc0
4 changed files with 11 additions and 12 deletions

View File

@ -89,7 +89,7 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& aSymbol
static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool aCached ) static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool aCached )
{ {
LIB_SYMBOL *symbol = nullptr; LIB_SYMBOL *symbol = nullptr;
wxString new_name = LIB_ID::FixIllegalChars( aName, false ); // wxString new_name = LIB_ID::FixIllegalChars( aName, false );
for( SYMBOL_LIB& each_lib : *aLibs ) for( SYMBOL_LIB& each_lib : *aLibs )
{ {
@ -99,7 +99,7 @@ static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool a
if( !aCached && each_lib.IsCache() ) if( !aCached && each_lib.IsCache() )
continue; continue;
symbol = each_lib.FindSymbol( new_name ); symbol = each_lib.FindSymbol( aName );
if( symbol ) if( symbol )
break; break;

View File

@ -1337,13 +1337,11 @@ void SCH_SCREENS::UpdateSymbolLinks( REPORTER* aReporter )
bool SCH_SCREENS::HasNoFullyDefinedLibIds() bool SCH_SCREENS::HasNoFullyDefinedLibIds()
{ {
SCH_SCREEN* screen; SCH_SCREEN* screen;
unsigned cnt = 0;
for( screen = GetFirst(); screen; screen = GetNext() ) for( screen = GetFirst(); screen; screen = GetNext() )
{ {
for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) ) for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
{ {
cnt++;
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item ); SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
if( !symbol->GetLibId().GetLibNickname().empty() ) if( !symbol->GetLibId().GetLibNickname().empty() )
@ -1351,7 +1349,7 @@ bool SCH_SCREENS::HasNoFullyDefinedLibIds()
} }
} }
return cnt != 0; return true;
} }

View File

@ -250,9 +250,9 @@ int SCH_EDITOR_CONTROL::UpdateFind( const TOOL_EVENT& aEvent )
auto visit = auto visit =
[&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet ) [&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet )
{ {
// We may get triggered when the dialog is not opened due to binding SelectedItemsModified // We may get triggered when the dialog is not opened due to binding
// we also get triggered when the find dialog is closed....so we need to double check the dialog is open // SelectedItemsModified we also get triggered when the find dialog is
// closed....so we need to double check the dialog is open.
if( m_frame->m_findReplaceDialog != nullptr if( m_frame->m_findReplaceDialog != nullptr
&& !data.GetFindString().IsEmpty() && !data.GetFindString().IsEmpty()
&& aItem->Matches( data, aSheet ) ) && aItem->Matches( data, aSheet ) )
@ -441,7 +441,8 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
} }
} }
std::sort( paths.begin(), paths.end(), [] ( const SCH_SHEET_PATH* lhs, const SCH_SHEET_PATH* rhs ) -> bool std::sort( paths.begin(), paths.end(), [] ( const SCH_SHEET_PATH* lhs,
const SCH_SHEET_PATH* rhs ) -> bool
{ {
int retval = lhs->ComparePageNumAndName( *rhs ); int retval = lhs->ComparePageNumAndName( *rhs );