Use hash (not page no) to determine when we've found the current sheet.

Also enforces strict ordering in another page number sorter, although
this has nothing to do with the bug below.

Fixes https://gitlab.com/kicad/code/kicad/issues/12043
This commit is contained in:
Jeff Young 2022-11-20 13:10:52 +00:00
parent 3747cae7dc
commit 2919490e92
2 changed files with 9 additions and 2 deletions

View File

@ -735,7 +735,14 @@ void SCH_SHEET_LIST::SortByPageNumbers( bool aUpdateVirtualPageNums )
std::sort( begin(), end(), std::sort( begin(), end(),
[]( SCH_SHEET_PATH a, SCH_SHEET_PATH b ) -> bool []( SCH_SHEET_PATH a, SCH_SHEET_PATH b ) -> bool
{ {
return a.ComparePageNum( b ) < 0; int retval = a.ComparePageNum( b );
if( retval < 0 )
return true;
else if( retval > 0 )
return false;
else /// Enforce strict ordering. If the page numbers are the same, use UUIDs
return a.GetCurrentHash() < b.GetCurrentHash();
} ); } );
if( aUpdateVirtualPageNums ) if( aUpdateVirtualPageNums )

View File

@ -531,7 +531,7 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
{ {
if( afterSheet ) if( afterSheet )
{ {
if( afterSheet->GetPageNumber() == sheet->GetPageNumber() ) if( afterSheet->GetCurrentHash() == sheet->GetCurrentHash() )
afterSheet = nullptr; afterSheet = nullptr;
continue; continue;