diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index c25a46e5cc..ba96d42164 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -171,7 +171,8 @@ static const TOOL_ACTION ACT_SwitchCornerMode( "pcbnew.InteractiveRouter.SwitchR ROUTER_TOOL::ROUTER_TOOL() : TOOL_BASE( "pcbnew.InteractiveRouter" ), - m_lastTargetLayer( UNDEFINED_LAYER ) + m_lastTargetLayer( UNDEFINED_LAYER ), + m_inRouterTool( false ) { } @@ -1394,6 +1395,11 @@ void ROUTER_TOOL::breakTrack() int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent ) { + if( m_inRouterTool ) + return 0; + + REENTRANCY_GUARD guard( &m_inRouterTool ); + PNS::ROUTER_MODE mode = aEvent.Parameter(); PCB_EDIT_FRAME* frame = getEditFrame(); VIEW_CONTROLS* controls = getViewControls(); diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h index a622d7b2fe..c0dd04719e 100644 --- a/pcbnew/router/router_tool.h +++ b/pcbnew/router/router_tool.h @@ -89,6 +89,8 @@ private: std::shared_ptr m_trackViaMenu; int m_lastTargetLayer; + + bool m_inRouterTool; // Re-entrancy guard }; #endif