Remove redundant ExchangeItem call

This was originally here to solve
https://gitlab.com/kicad/code/kicad/-/issues/17851 However, since then,
we have changed how pins are handled in UpdatePins(), leading to the
exchanged item having dangling pointers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21995
This commit is contained in:
Seth Hillbrand
2025-10-29 09:15:29 -07:00
parent b5c6be8490
commit 3e63d5c5a6
@@ -640,15 +640,6 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit, const std::map<S
screen->Remove( symbol );
SCH_SYMBOL* symbol_copy = static_cast<SCH_SYMBOL*>( symbol->Clone() );
aCommit->Modified( symbol, symbol_copy, screen );
CONNECTION_GRAPH* connectionGraph = screen->Schematic()->ConnectionGraph();
// When we replace the lib symbol below, we free the associated pins if the new symbol has
// fewer than the original. This will cause the connection graph to be out of date unless
// we replace references in the graph to the old symbol/pins with references to the ones
// stored in the undo stack.
if( connectionGraph )
connectionGraph->ExchangeItem( symbol, symbol_copy );
}
for( const auto& [ symbol, symbol_change_info ] : symbols )