Re-route m_last_head after routing fails

This should ensure the shove state gets reverted

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9023
This commit is contained in:
Roberto Fernandez Bautista 2022-09-01 15:25:38 +02:00 committed by Seth Hillbrand
parent 1d5db513a1
commit 83305dd407
1 changed files with 11 additions and 0 deletions

View File

@ -971,9 +971,20 @@ void LINE_PLACER::routeStep( const VECTOR2I& aP )
if( fail )
{
PNS_DBG( Dbg(), Message, "routeStep failed" );
if( m_last_head.PointCount() > 0 )
{
m_head = m_last_head;
PNS_DBG( Dbg(), AddLine, m_head.CLine(), GREEN, 100000, "head-before-re-route" );
VECTOR2I lastValidRoutePoint = m_head.CPoint( m_head.PointCount() - 1 );
// Re-route, so the shove state gets reverted
if( !routeHead( lastValidRoutePoint, m_head ) )
PNS_DBG( Dbg(), Message, "****Unable to recover.***** Route head failed, second time" );
PNS_DBG( Dbg(), AddLine, m_head.CLine(), GREEN, 100000, "head-after-re-route" );
}
else
{