Clear ratsnest when removing nets

While we can keep the vector for nets, we need to ensure that the data
are cleared to prevent stale pointer access

Fixes https://gitlab.com/kicad/code/kicad/issues/12564
This commit is contained in:
Seth Hillbrand 2022-10-03 09:32:29 -07:00
parent 9186be600b
commit 15d52c91e4
1 changed files with 5 additions and 0 deletions

View File

@ -209,6 +209,11 @@ void CONNECTIVITY_DATA::RecalculateRatsnest( BOARD_COMMIT* aCommit )
for( unsigned int i = prevSize; i < m_nets.size(); i++ )
m_nets[i] = new RN_NET;
}
else
{
for( size_t ii = lastNet; ii < m_nets.size(); ++ii )
m_nets[ii]->Clear();
}
const std::vector<std::shared_ptr<CN_CLUSTER>>& clusters = m_connAlgo->GetClusters();