Browse Source

Fix sheet number access

getPageNumber is actually asking for the parent path rather than the
sheet path itself.  Without this, we don't match the cached page number
and instead match against the virtual page number that is position
dependent

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21296

(cherry picked from commit 8edc7b8b40)
pull/18/head
Seth Hillbrand 5 months ago
parent
commit
9f903a2661
  1. 13
      eeschema/sch_sheet_path.cpp

13
eeschema/sch_sheet_path.cpp

@ -847,16 +847,13 @@ void SCH_SHEET_LIST::SortByHierarchicalPageNumbers( bool aUpdateVirtualPageNums
SCH_SHEET* sheet_b = b.at( common_len );
// Create partial paths to get to these sheets for page number comparison
KIID_PATH path_a, path_b;
for( size_t i = 0; i <= common_len; i++ )
{
path_a.push_back( a.at( i )->m_Uuid );
path_b.push_back( b.at( i )->m_Uuid );
}
KIID_PATH ancestor;
for( size_t i = 0; i < common_len; i++ )
ancestor.push_back( a.at( i )->m_Uuid );
// Compare page numbers - use the last sheet's page number
wxString page_a = sheet_a->getPageNumber( path_a );
wxString page_b = sheet_b->getPageNumber( path_b );
wxString page_a = sheet_a->getPageNumber( ancestor );
wxString page_b = sheet_b->getPageNumber( ancestor );
int retval = SCH_SHEET::ComparePageNum( page_a, page_b );

Loading…
Cancel
Save