Fix crash when switching from dragging to routine (PNS router)

The attached patch fixes a bug where triggering InlineDrag while routing
is in progress will crash pcbnew.  The problem is that the InlineDrag
event does not terminate performRouting.  Once InlineDrag is finished
it will call StopRouting which deletes the m_placer.  The Wait() in
performRouting will then return and it will crash as soon as it tries
to access the m_placer.
This commit is contained in:
Julius Schmidt 2017-03-07 13:56:44 +01:00 committed by Maciej Suminski
parent c86773462f
commit 29eb696ef7
1 changed files with 5 additions and 1 deletions

View File

@ -601,6 +601,9 @@ void ROUTER_TOOL::performRouting()
while( OPT_TOOL_EVENT evt = Wait() )
{
// Don't crash if we missed an operation that cancelled routing.
wxCHECK2( m_router->RoutingInProgress(), break );
if( evt->IsMotion() )
{
m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) );
@ -644,7 +647,8 @@ void ROUTER_TOOL::performRouting()
break;
}
else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
|| evt->IsUndoRedo() )
|| evt->IsUndoRedo()
|| evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
break;
}