diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 05c34ea941..5e52049d1c 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -444,6 +444,8 @@ bool TRACKS_CLEANER::deleteNullSegments() void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aTrack, std::set& aToRemove ) { + if( aTrack->GetFlags() & STRUCT_DELETED ) + return; for( auto other : m_brd->Tracks() ) { @@ -454,6 +456,9 @@ void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aTrack, std::setGetFlags() & STRUCT_DELETED ) + continue; + // Must be of the same type, on the same layer and the endpoints // must be the same (maybe swapped) if( ( aTrack->Type() == other->Type() ) && @@ -464,6 +469,7 @@ void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aTrack, std::setGetStart() == other->GetEnd() ) && ( aTrack->GetEnd() == other->GetStart() ) ) ) { + other->SetFlags( STRUCT_DELETED ); aToRemove.insert( other ); } }