From ce5fbb0c58a9986e915d9107e9420eab60ebb03e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 26 Oct 2020 13:48:32 +0000 Subject: [PATCH] Small performance boost and fix a bug between tracks and arcs. --- pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp | 1 + pcbnew/tracks_cleaner.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp index f2d576a31f..72e876dcbd 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp @@ -122,6 +122,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun ) m_changesTreeModel->SetProvider( provider ); m_parentFrame->GetToolManager()->GetTool()->CheckAllZones( this ); + wxSafeYield(); // Timeslice to close zone progress reporter m_changesTreeModel->SetProvider( nullptr ); m_items.clear(); diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index 19cd213e0d..80a71241a6 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -373,18 +373,18 @@ void TRACKS_CLEANER::cleanupSegments() std::set toRemove; // Remove duplicate segments (2 superimposed identical segments): - for( auto it = m_brd->Tracks().begin(); it != m_brd->Tracks().end(); it++ ) + for( size_t ii = 0; ii < m_brd->Tracks().size(); ++ii ) { - TRACK* track1 = *it; + TRACK* track1 = m_brd->Tracks()[ii]; if( track1->Type() != PCB_TRACE_T || track1->HasFlag( IS_DELETED ) || track1->IsLocked() ) continue; - for( auto it2 = it + 1; it2 != m_brd->Tracks().end(); it2++ ) + for( size_t jj = ii + 1; jj < m_brd->Tracks().size(); ++jj ) { - TRACK* track2 = *it2; + TRACK* track2 = m_brd->Tracks()[jj]; - if( track2->HasFlag( IS_DELETED ) ) + if( track2->Type() != PCB_TRACE_T || track2->HasFlag( IS_DELETED ) ) continue; if( track1->IsPointOnEnds( track2->GetStart() )