From cbca180a129b5fb4b922bb97cb60d9e2119e240f Mon Sep 17 00:00:00 2001 From: charras Date: Thu, 5 Mar 2009 15:58:06 +0000 Subject: [PATCH] bug fix 2660689 Unconnected pads in RC4 --- CHANGELOG.txt | 1 + pcbnew/connect.cpp | 5 ++--- pcbnew/editrack.cpp | 1 + pcbnew/tr_modif.cpp | 24 ++++++++++++++++-------- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index df0b5b9991..fca77ed793 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -17,6 +17,7 @@ email address. So they are temporary disabled (see my comments in these functions) bug fix in Marque_Une_Piste(): the last segments created can be see as part of the flagged track: so delete track (or edit track width) deletes the track and some others segments (last created) + bug fix 2660689 Unconnected pads in RC4. Also fixed some no deletion of the old track when creating a new track 2009-Feb-25 UPDATE Wayne Stambaugh diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index 378ade8179..1223757fac 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -346,9 +346,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code ) if( m_Pcb->m_Track ) { TRACK* pt_start_conn; - TRACK* pt_end_conn; - - pt_end_conn = NULL; + TRACK* pt_end_conn = NULL; pt_start_conn = m_Pcb->m_Track.GetFirst()->GetStartNetCode( net_code ); if( pt_start_conn ) @@ -441,6 +439,7 @@ static void Build_Pads_Info_Connections_By_Tracks( TRACK* pt_start_conn, TRACK* { Track->end = Locate_Piste_Connectee( Track, Track, pt_end_conn, END ); } + if( Track == pt_end_conn ) break; } diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 08531301b2..3419cec253 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -505,6 +505,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC ) for( track=firstTrack; track && iNext() ) { track->m_Flags = 0; + track->SetState( BUSY, OFF ); } // erase the old track, if exists diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index d1d6bff321..d7cfa0de89 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -81,10 +81,12 @@ int EraseOldTrack( WinEDA_BasePcbFrame* frame, BOARD* Pcb, wxDC* DC, BufEnd = BufDeb->GetEndNetCode( netcode ); /* nettoyage des flags pour tout le net */ - for( pt_del = BufDeb; pt_del && pt_del != BufEnd; pt_del = pt_del->Next() ) + for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) { D(printf("track %p turning off BUSY | EDIT | CHAIN\n", pt_del );) pt_del->SetState( BUSY | EDIT | CHAIN, OFF ); + if( pt_del == BufEnd ) // Last segment reached + break; } /* Calcul des points limites de la nouvelle piste */ @@ -173,10 +175,12 @@ int EraseOldTrack( WinEDA_BasePcbFrame* frame, BOARD* Pcb, wxDC* DC, if( nbconnect == 0 ) { - /* nettoyage des flags */ - for( pt_del = BufDeb; pt_del && pt_del != BufEnd; pt_del = pt_del->Next() ) + /* Clear used flagss */ + for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) { - pt_del->SetState( DELETED | EDIT | CHAIN, OFF ); + pt_del->SetState( BUSY | DELETED | EDIT | CHAIN, OFF ); + if( pt_del == BufEnd ) // Last segment reached + break; } return 0; @@ -191,10 +195,12 @@ int EraseOldTrack( WinEDA_BasePcbFrame* frame, BOARD* Pcb, wxDC* DC, /* Examen de tous les segments marques */ while( nbconnect ) { - for( pt_del = BufDeb; pt_del && pt_del != BufEnd; pt_del = pt_del->Next() ) + for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) { if( pt_del->GetState( CHAIN ) ) break; + if( pt_del == BufEnd ) // Last segment reached + break; } nbconnect--; @@ -244,10 +250,12 @@ int EraseOldTrack( WinEDA_BasePcbFrame* frame, BOARD* Pcb, wxDC* DC, ListSetState( pt_del, nb_segm, BUSY, OFF ); } - /* nettoyage des flags */ - for( pt_del = Pcb->m_Track; pt_del && pt_del != BufEnd; pt_del = pt_del->Next() ) + /* Clear used flags */ + for( pt_del = Pcb->m_Track; pt_del; pt_del = pt_del->Next() ) { - pt_del->SetState( DELETED | EDIT | CHAIN, OFF ); + pt_del->SetState( BUSY | DELETED | EDIT | CHAIN, OFF ); + if( pt_del == BufEnd ) // Last segment reached + break; } return 0;