Re-entrancy guard for router tool.

Fixes https://gitlab.com/kicad/code/kicad/issues/12604
This commit is contained in:
Jeff Young 2022-10-17 13:20:40 +01:00
parent 46752499df
commit 413fd82813
2 changed files with 9 additions and 1 deletions

View File

@ -178,7 +178,8 @@ static const TOOL_ACTION ACT_SwitchCornerMode( "pcbnew.InteractiveRouter.SwitchR
ROUTER_TOOL::ROUTER_TOOL() :
TOOL_BASE( "pcbnew.InteractiveRouter" ),
m_lastTargetLayer( UNDEFINED_LAYER ),
m_originalActiveLayer( UNDEFINED_LAYER )
m_originalActiveLayer( UNDEFINED_LAYER ),
m_inRouterTool( false )
{
}
@ -1603,6 +1604,11 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
{
if( m_inRouterTool )
return 0;
REENTRANCY_GUARD guard( &m_inRouterTool );
PNS::ROUTER_MODE mode = aEvent.Parameter<PNS::ROUTER_MODE>();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
VIEW_CONTROLS* controls = getViewControls();

View File

@ -93,6 +93,8 @@ private:
int m_lastTargetLayer;
PCB_LAYER_ID m_originalActiveLayer;
bool m_inRouterTool; // Re-entrancy guard
};
#endif