Fix the last cause of duplicate segments when completing a route

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6863
This commit is contained in:
Jon Evans 2021-06-07 20:34:00 -04:00
parent ab82b01714
commit 75ce97e260
1 changed files with 9 additions and 4 deletions

View File

@ -1344,8 +1344,11 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
seg.SetWidth( pl.Width() ); seg.SetWidth( pl.Width() );
seg.SetLayer( m_currentLayer ); seg.SetLayer( m_currentLayer );
if( m_lastNode->Add( std::make_unique<SEGMENT>( seg ) ) ) std::unique_ptr<SEGMENT> sp = std::make_unique<SEGMENT>( seg );
lastItem = &seg; lastItem = sp.get();
if( !m_lastNode->Add( std::move( sp ) ) )
lastItem = nullptr;
} }
else else
{ {
@ -1356,8 +1359,10 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis
arc.SetWidth( pl.Width() ); arc.SetWidth( pl.Width() );
arc.SetLayer( m_currentLayer ); arc.SetLayer( m_currentLayer );
m_lastNode->Add( std::make_unique<ARC>( arc ) ); std::unique_ptr<ARC> ap = std::make_unique<ARC>( arc );
lastItem = &arc; lastItem = ap.get();
m_lastNode->Add( std::move( ap ) );
lastArc = arcIndex; lastArc = arcIndex;
} }
} }