From a2cf59cc89e608783ea2411fdcba485f02bf481a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 30 Jun 2025 20:43:30 -0600 Subject: [PATCH] Clear selections before deleting grid rows (KICAD-J40). --- pcbnew/dialogs/panel_setup_tracks_and_vias.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp index 86958ced7a..df8810a303 100644 --- a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp @@ -138,6 +138,9 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortTrackWidthsClick( wxCommandEvent& aEvent std::vector trackWidths; wxString msg; + m_trackWidthsGrid->ClearSelection(); + wxSafeYield(); + wxGridUpdateLocker lock( m_trackWidthsGrid ); for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row ) @@ -149,7 +152,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortTrackWidthsClick( wxCommandEvent& aEvent } std::sort( trackWidths.begin(), trackWidths.end() ); - m_trackWidthsGrid->DeleteRows(0, m_trackWidthsGrid->GetNumberRows(), false); + m_trackWidthsGrid->DeleteRows( 0, m_trackWidthsGrid->GetNumberRows(), false ); for( int width : trackWidths ) AppendTrackWidth( width ); @@ -161,6 +164,9 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortViaSizesClick( wxCommandEvent& aEvent ) std::vector vias; wxString msg; + m_trackWidthsGrid->ClearSelection(); + wxSafeYield(); + wxGridUpdateLocker lock( m_viaSizesGrid ); for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) @@ -182,7 +188,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortViaSizesClick( wxCommandEvent& aEvent ) } std::sort( vias.begin(), vias.end() ); - m_viaSizesGrid->DeleteRows(0, m_viaSizesGrid->GetNumberRows(), false ); + m_viaSizesGrid->DeleteRows( 0, m_viaSizesGrid->GetNumberRows(), false ); for( const VIA_DIMENSION& via : vias ) AppendViaSize( via.m_Diameter, via.m_Drill ); @@ -194,6 +200,9 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortDiffPairsClick( wxCommandEvent& aEvent ) wxString msg; std::vector diffPairs; + m_trackWidthsGrid->ClearSelection(); + wxSafeYield(); + wxGridUpdateLocker lock( m_diffPairsGrid ); for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row ) @@ -218,7 +227,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortDiffPairsClick( wxCommandEvent& aEvent ) } std::sort( diffPairs.begin(), diffPairs.end() ); - m_diffPairsGrid->DeleteRows(0, m_diffPairsGrid->GetNumberRows(), false ); + m_diffPairsGrid->DeleteRows( 0, m_diffPairsGrid->GetNumberRows(), false ); for( const DIFF_PAIR_DIMENSION& dp : diffPairs ) AppendDiffPairs( dp.m_Width, dp.m_Gap, dp.m_ViaGap );