Eeschema: Add bit that was missing from commit 7ac83ac64

This part of the check removes recursive sheets from the schematic when
loading and notifies the user that their schematic has been repaired.

(cherry picked from commit 128ec782dd)
This commit is contained in:
Seth Hillbrand 2020-01-27 06:38:14 -08:00
parent dc3c6b2f39
commit 3ce29a3d7e
1 changed files with 15 additions and 1 deletions

View File

@ -455,6 +455,8 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
{
wxCHECK_RET( aSheet != NULL, wxT( "Cannot build sheet list from undefined sheet." ) );
std::vector<SCH_SHEET*> badSheets;
if( aSheet == g_RootSheet )
m_isRootSheet = true;
@ -477,11 +479,23 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
if( item->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = (SCH_SHEET*) item;
BuildSheetList( sheet );
if( !m_currentSheetPath.TestForRecursion(
sheet->GetFileName(), aSheet->GetFileName() ) )
BuildSheetList( sheet );
else
badSheets.push_back( sheet );
}
item = item->Next();
}
for( auto sheet : badSheets )
{
aSheet->GetScreen()->Remove( sheet );
aSheet->GetScreen()->SetModify();
}
}
m_currentSheetPath.pop_back();