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();
@ -620,7 +620,9 @@ bool ROUTER::ContinueFromEnd()
return false;
// Attempt to route to our current position
Move( currentEnd, current );
Move( currentEnd, nullptr );
*aNewStartItem = otherEndItem;
return true;
}

View File

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

View File

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