Iterate over screens, not sheets, for bus alias loading

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7147
This commit is contained in:
Jon Evans 2021-02-13 11:04:55 -05:00
parent cb27d14ecb
commit c51e8ff0c6
1 changed files with 3 additions and 3 deletions

View File

@ -198,14 +198,14 @@ bool DIALOG_BUS_MANAGER::TransferDataToWindow()
m_aliases.clear();
m_screens.clear();
const SCH_SHEET_LIST& sheets = m_parent->Schematic().GetSheets();
SCH_SCREENS screens( m_parent->Schematic().Root() );
std::vector< std::shared_ptr<BUS_ALIAS> > original_aliases;
// collect aliases from each open sheet
for( unsigned i = 0; i < sheets.size(); i++ )
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
{
auto sheet_aliases = sheets[i].LastScreen()->GetBusAliases();
std::unordered_set<std::shared_ptr<BUS_ALIAS>> sheet_aliases = screen->GetBusAliases();
original_aliases.insert( original_aliases.end(), sheet_aliases.begin(),
sheet_aliases.end() );
}