From 451f8eefc07817acae38422f8a780ab9c6d71d9f Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 9 Sep 2021 10:19:25 -0400 Subject: [PATCH] Eeschema: fix broken project symbol rescue bug. Fixes https://gitlab.com/kicad/code/kicad/-/issues/9111 --- eeschema/project_rescue.cpp | 4 ++-- eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp | 2 +- eeschema/sch_screen.cpp | 4 +--- eeschema/tools/sch_editor_control.cpp | 13 +++++++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp index c3ffc7b452..d897984224 100644 --- a/eeschema/project_rescue.cpp +++ b/eeschema/project_rescue.cpp @@ -89,7 +89,7 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector& aSymbol static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool aCached ) { 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 ) { @@ -99,7 +99,7 @@ static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool a if( !aCached && each_lib.IsCache() ) continue; - symbol = each_lib.FindSymbol( new_name ); + symbol = each_lib.FindSymbol( aName ); if( symbol ) break; diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 62fafa00c8..32b4154e3e 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -2808,7 +2808,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadHeader( FILE_LINE_READER& aReader ) LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVersion, - int aMinorVersion, LIB_SYMBOL_MAP* aMap ) + int aMinorVersion, LIB_SYMBOL_MAP* aMap ) { const char* line = aReader.Line(); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 225db8de14..5fdc16c417 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -1337,13 +1337,11 @@ void SCH_SCREENS::UpdateSymbolLinks( REPORTER* aReporter ) bool SCH_SCREENS::HasNoFullyDefinedLibIds() { SCH_SCREEN* screen; - unsigned cnt = 0; for( screen = GetFirst(); screen; screen = GetNext() ) { for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) ) { - cnt++; SCH_SYMBOL* symbol = static_cast( item ); if( !symbol->GetLibId().GetLibNickname().empty() ) @@ -1351,7 +1349,7 @@ bool SCH_SCREENS::HasNoFullyDefinedLibIds() } } - return cnt != 0; + return true; } diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 8f35345fb4..5c7ef5be96 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -250,11 +250,11 @@ int SCH_EDITOR_CONTROL::UpdateFind( const TOOL_EVENT& aEvent ) auto visit = [&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet ) { - // We may get triggered when the dialog is not opened due to binding 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 - && !data.GetFindString().IsEmpty() + // We may get triggered when the dialog is not opened due to binding + // 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 + && !data.GetFindString().IsEmpty() && aItem->Matches( data, aSheet ) ) { aItem->SetForceVisible( true ); @@ -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 );