fix TRACK::Copy() usage

This commit is contained in:
dickelbeck 2007-09-11 04:13:12 +00:00
parent 38f9963e7a
commit 24a1b05d6e
1 changed files with 23 additions and 8 deletions

View File

@ -390,12 +390,18 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{ {
next_track = track->Next(); next_track = track->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ /* la piste est ici bonne a etre deplacee */ {
/* la piste est ici bonne a etre deplacee */
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
new_track = track->Copy( 1 ); new_track = track->Copy();
new_track->Insert( m_Pcb, NULL ); new_track->Insert( m_Pcb, NULL );
new_track->m_Start.x += deltaX; new_track->m_Start.y += deltaY;
new_track->m_End.x += deltaX; new_track->m_End.y += deltaY; new_track->m_Start.x += deltaX;
new_track->m_Start.y += deltaY;
new_track->m_End.x += deltaX;
new_track->m_End.y += deltaY;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
} }
track = next_track; track = next_track;
@ -407,12 +413,21 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{ {
next_track = track->Next(); next_track = track->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ /* la piste est ici bonne a etre deplacee */ {
/* la piste est ici bonne a etre deplacee */
// @todo: bug? memory leak at this point:
new_track = new TRACK( m_Pcb ); new_track = new TRACK( m_Pcb );
new_track = track->Copy( 1 );
new_track = track->Copy();
new_track->Insert( m_Pcb, NULL ); new_track->Insert( m_Pcb, NULL );
new_track->m_Start.x += deltaX; new_track->m_Start.y += deltaY;
new_track->m_End.x += deltaX; new_track->m_End.y += deltaY; new_track->m_Start.x += deltaX;
new_track->m_Start.y += deltaY;
new_track->m_End.x += deltaX;
new_track->m_End.y += deltaY;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
} }
track = next_track; track = next_track;