Fix typo and clean up leftover tracks
This commit is contained in:
parent
1a102f03c0
commit
ed66c0f14d
|
@ -397,6 +397,7 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
|
|||
if( aMergeSegments )
|
||||
{
|
||||
bool merged;
|
||||
std::vector<TRACK*> addedTracks;
|
||||
|
||||
// We need to add any tracks that were added in the commit, to handle the case where this is
|
||||
// called from the router and we are cleaning up right before the router commit is pushed.
|
||||
|
@ -405,7 +406,10 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
|
|||
for( EDA_ITEM* item : m_commit.GetAddedItems() )
|
||||
{
|
||||
if( item->Type() == PCB_TRACE_T )
|
||||
{
|
||||
m_brd->Add( static_cast<TRACK*>( item ), ADD_MODE::BULK_APPEND );
|
||||
addedTracks.emplace_back( static_cast<TRACK*>( item ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,6 +459,14 @@ void TRACKS_CLEANER::cleanup( bool aDeleteDuplicateVias, bool aDeleteNullSegment
|
|||
}
|
||||
}
|
||||
} while( merged );
|
||||
|
||||
// Remove any temporary tracks that still exist that were added above; they will be
|
||||
// re-added by the commit
|
||||
for( TRACK* track : addedTracks )
|
||||
{
|
||||
if( m_commit.GetStatus( track ) != 0 )
|
||||
m_brd->Remove( track, REMOVE_MODE::BULK );
|
||||
}
|
||||
}
|
||||
|
||||
for( TRACK* track : m_brd->Tracks() )
|
||||
|
@ -533,7 +545,7 @@ bool TRACKS_CLEANER::mergeCollinearSegments( TRACK* aSeg1, TRACK* aSeg2 )
|
|||
// Merge succesful, seg2 has to go away
|
||||
m_brd->Remove( aSeg2 );
|
||||
|
||||
if( m_commit.GetStatus( aSeg1 ) == 0 )
|
||||
if( m_commit.GetStatus( aSeg2 ) == 0 )
|
||||
{
|
||||
m_commit.Removed( aSeg2 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue