From 3a29fa44e313c1f308f026c41ec36cdab1a0ecaa Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 23 Apr 2024 19:35:29 -0700 Subject: [PATCH] Ensure that missing pins are added to extraction When changing from a larger part to a smaller part, the previously existing pins may be removed from the screen but still linked to elements in the connection graph because we don't set them dirty unless the changed element overlaps Fixes https://gitlab.com/kicad/code/kicad/-/issues/17851 (cherry picked from commit 0cd3e17db7ed50cc6ee0be8b2476f55f547d0921) --- eeschema/sch_edit_frame.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index d20e7a3f44..ba5148430e 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -1736,6 +1736,26 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() ); changed_items.insert( item ); + for( SCH_SHEET_PATH& path : paths ) + item_paths.insert( std::make_pair( path, item ) ); + + item = dynamic_cast( changed_list->GetPickedItemLink( ii ) ); + + if( !item || !item->IsConnectable() ) + continue; + + tmp_pts = item->GetConnectionPoints(); + pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() ); + changed_items.insert( item ); + + // We have to directly add the pins here because the link may not exist on the schematic + // anymore and so won't be picked up by GetScreen()->Items().Overlapping() below. + if( SCH_SYMBOL* symbol = dynamic_cast( item ) ) + { + std::vector pins = symbol->GetPins(); + changed_items.insert( pins.begin(), pins.end() ); + } + for( SCH_SHEET_PATH& path : paths ) item_paths.insert( std::make_pair( path, item ) ); }