From 2dfe4d4716466100def1e9057588d4daf6d0660b Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 25 Mar 2025 16:02:31 -0700 Subject: [PATCH] Cleanup noisy assert When undoing the addition of a symbol to the schematic, the symbol does not originally have a parent, so we can't find the current sheet in order to find the correct pins. But we know the sheet in the undo list, so we can just pass it in --- eeschema/schematic_undo_redo.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index 242f888b7a..59231d7c14 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -287,7 +287,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList ) bool rebuildHierarchyNavigator = false; bool refreshHierarchy = false; SCH_CLEANUP_FLAGS connectivityCleanUp = NO_CLEANUP; - SCH_SHEET_LIST sheets; + SCH_SHEET_LIST sheets= m_schematic->Hierarchy(); bool clearedRepeatItems = false; // Undo in the reverse order of list creation: (this can allow stacked changes like the @@ -295,9 +295,10 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList ) // After hitting 0, subtracting 1 will roll the value over to its max representation for( unsigned ii = aList->GetCount() - 1; ii < std::numeric_limits::max(); ii-- ) { - UNDO_REDO status = aList->GetPickedItemStatus( ii ); - EDA_ITEM* eda_item = aList->GetPickedItem( ii ); - SCH_SCREEN* screen = dynamic_cast( aList->GetScreenForItem( ii ) ); + UNDO_REDO status = aList->GetPickedItemStatus( ii ); + EDA_ITEM* eda_item = aList->GetPickedItem( ii ); + SCH_SCREEN* screen = dynamic_cast( aList->GetScreenForItem( ii ) ); + SCH_SHEET_PATH undoSheet = sheets.FindSheetForScreen( screen ); eda_item->SetFlags( aList->GetPickerFlags( ii ) ); eda_item->ClearEditFlags(); @@ -319,7 +320,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList ) wxCHECK( symbol, /* void */ ); - for( SCH_PIN* pin : symbol->GetPins() ) + for( SCH_PIN* pin : symbol->GetPins( &undoSheet ) ) pin->SetConnectivityDirty(); } else if( schItem->Type() == SCH_SHEET_T ) @@ -388,12 +389,6 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList ) } else if( status == UNDO_REDO::PAGESETTINGS ) { - // Lazy eval of sheet list; this is expensive even when unsorted - if( sheets.empty() ) - sheets = m_schematic->Hierarchy(); - - SCH_SHEET_PATH undoSheet = sheets.FindSheetForScreen( screen ); - if( GetCurrentSheet() != undoSheet ) { SetCurrentSheet( undoSheet );