Route from end: fix crash and snapping bug

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13992
This commit is contained in:
Mike Williams 2023-10-18 12:32:32 -04:00
parent 5cd5194e89
commit 70917a14e7
3 changed files with 7 additions and 4 deletions

View File

@ -589,7 +589,7 @@ bool ROUTER::Finish()
} }
bool ROUTER::ContinueFromEnd() bool ROUTER::ContinueFromEnd( ITEM** aNewStartItem )
{ {
PLACEMENT_ALGO* placer = Placer(); PLACEMENT_ALGO* placer = Placer();
@ -620,7 +620,9 @@ bool ROUTER::ContinueFromEnd()
return false; return false;
// Attempt to route to our current position // Attempt to route to our current position
Move( currentEnd, current ); Move( currentEnd, nullptr );
*aNewStartItem = otherEndItem;
return true; return true;
} }

View File

@ -147,7 +147,7 @@ public:
bool StartRouting( const VECTOR2I& aP, ITEM* aItem, int aLayer ); bool StartRouting( const VECTOR2I& aP, ITEM* aItem, int aLayer );
bool Move( const VECTOR2I& aP, ITEM* aItem ); bool Move( const VECTOR2I& aP, ITEM* aItem );
bool Finish(); bool Finish();
bool ContinueFromEnd(); bool ContinueFromEnd( ITEM** aNewStartItem );
bool FixRoute( const VECTOR2I& aP, ITEM* aItem, bool aForceFinish = false ); bool FixRoute( const VECTOR2I& aP, ITEM* aItem, bool aForceFinish = false );
void BreakSegment( ITEM *aItem, const VECTOR2I& aP ); void BreakSegment( ITEM *aItem, const VECTOR2I& aP );

View File

@ -1378,10 +1378,11 @@ void ROUTER_TOOL::performRouting()
{ {
bool needsAppend = m_router->Placer()->HasPlacedAnything(); bool needsAppend = m_router->Placer()->HasPlacedAnything();
if( m_router->ContinueFromEnd() ) if( m_router->ContinueFromEnd( &m_startItem ) )
{ {
syncRouterAndFrameLayer(); syncRouterAndFrameLayer();
m_startSnapPoint = m_router->Placer()->CurrentStart(); m_startSnapPoint = m_router->Placer()->CurrentStart();
updateEndItem( *evt );
// Warp the mouse to wherever we actually ended up routing to // Warp the mouse to wherever we actually ended up routing to
controls()->WarpMouseCursor( m_router->Placer()->CurrentEnd(), true, true ); controls()->WarpMouseCursor( m_router->Placer()->CurrentEnd(), true, true );