Don't double-remove nets when netcodes are reused
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8206
This commit is contained in:
parent
55c1d814f9
commit
ce01a28aad
|
@ -673,25 +673,27 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode )
|
|||
{
|
||||
NETINFO_ITEM* item = static_cast<NETINFO_ITEM*>( aBoardItem );
|
||||
NETINFO_ITEM* unconnected = m_NetInfo.GetNetItem( NETINFO_LIST::UNCONNECTED );
|
||||
int removedCode = item->GetNetCode();
|
||||
|
||||
for( FOOTPRINT* fp : m_footprints )
|
||||
{
|
||||
for( PAD* pad : fp->Pads() )
|
||||
{
|
||||
if( pad->GetNetCode() == removedCode )
|
||||
if( pad->GetNet() == item )
|
||||
pad->SetNet( unconnected );
|
||||
}
|
||||
}
|
||||
|
||||
for( ZONE* zone : m_zones )
|
||||
{
|
||||
if( zone->GetNetCode() == removedCode )
|
||||
if( zone->GetNet() == item )
|
||||
zone->SetNet( unconnected );
|
||||
}
|
||||
|
||||
for( TRACK* track : TracksInNet( removedCode ) )
|
||||
for( TRACK* track : m_tracks )
|
||||
{
|
||||
if( track->GetNet() == item )
|
||||
track->SetNet( unconnected );
|
||||
}
|
||||
|
||||
m_NetInfo.RemoveNet( item );
|
||||
break;
|
||||
|
|
|
@ -83,10 +83,13 @@ NETINFO_ITEM* NETINFO_LIST::GetNetItem( const wxString& aNetName ) const
|
|||
|
||||
void NETINFO_LIST::RemoveNet( NETINFO_ITEM* aNet )
|
||||
{
|
||||
bool removed = false;
|
||||
|
||||
for( NETCODES_MAP::iterator i = m_netCodes.begin(); i != m_netCodes.end(); ++i )
|
||||
{
|
||||
if ( i->second == aNet )
|
||||
{
|
||||
removed = true;
|
||||
m_netCodes.erase(i);
|
||||
break;
|
||||
}
|
||||
|
@ -96,11 +99,14 @@ void NETINFO_LIST::RemoveNet( NETINFO_ITEM* aNet )
|
|||
{
|
||||
if ( i->second == aNet )
|
||||
{
|
||||
wxASSERT_MSG( removed, "NETINFO_LIST::RemoveNet: target net found in m_netNames "
|
||||
"but not m_netCodes!" );
|
||||
m_netNames.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( removed )
|
||||
m_newNetCode = std::min( m_newNetCode, aNet->m_netCode - 1 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue