More tool loop safety.

This commit is contained in:
Jeff Young 2025-07-03 21:33:49 -06:00
parent ee097a7073
commit 3a8ea50783
3 changed files with 16 additions and 12 deletions

View File

@ -1594,6 +1594,7 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( ACTIONS::selectionClear );
TOOL_EVENT pushedEvent = aEvent;
frame->PushTool( aEvent );
auto setCursor =
@ -1701,7 +1702,7 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
}
m_iface->SetCommitFlags( 0 );
frame->PopTool( aEvent );
frame->PopTool( pushedEvent );
return 0;
}
@ -1728,6 +1729,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
// Deselect all items
m_toolMgr->RunAction( ACTIONS::selectionClear );
TOOL_EVENT pushedEvent = aEvent;
frame->PushTool( aEvent );
auto setCursor =
@ -1757,7 +1759,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
if( evt->IsCancelInteractive() )
{
frame->PopTool( aEvent );
frame->PopTool( pushedEvent );
break;
}
else if( evt->IsActivate() )
@ -1769,7 +1771,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
}
else
{
frame->PopTool( aEvent );
frame->PopTool( pushedEvent );
break;
}
}
@ -1838,7 +1840,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
if( m_cancelled )
{
frame->PopTool( aEvent );
frame->PopTool( pushedEvent );
break;
}
}
@ -2086,8 +2088,7 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT
bool ROUTER_TOOL::CanInlineDrag( int aDragMode )
{
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( ACTIONS::selectionCursor,
NeighboringSegmentFilter );
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( ACTIONS::selectionCursor, NeighboringSegmentFilter );
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( selection.Size() == 1 )
@ -2174,6 +2175,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( ACTIONS::selectionClear );
TOOL_EVENT pushedEvent = aEvent;
frame()->PushTool( aEvent );
Activate();
@ -2337,7 +2339,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
restoreSelection( selection );
controls()->ForceCursorPosition( false );
frame()->PopTool( aEvent );
frame()->PopTool( pushedEvent );
highlightNets( false );
return 0;
}
@ -2569,7 +2571,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
controls()->SetAutoPan( false );
controls()->ForceCursorPosition( false );
frame()->UndoRedoBlock( false );
frame()->PopTool( aEvent );
frame()->PopTool( pushedEvent );
highlightNets( false );
view()->ClearPreview();
view()->ShowPreview( false );

View File

@ -1117,6 +1117,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( ACTIONS::selectionClear );
TOOL_EVENT pushedEvent = aEvent;
m_frame->PushTool( aEvent );
auto setCursor =
@ -1192,7 +1193,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
}
else
{
m_frame->PopTool( aEvent );
m_frame->PopTool( pushedEvent );
break;
}
}
@ -1208,7 +1209,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
}
else
{
frame()->PopTool( aEvent );
frame()->PopTool( pushedEvent );
break;
}
}

View File

@ -320,6 +320,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
if( m_dragging || selection.Empty() )
return false;
TOOL_EVENT pushedEvent = aEvent;
editFrame->PushTool( aEvent );
Activate();
@ -400,7 +401,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
if( selection.IsHover() )
m_toolMgr->RunAction( ACTIONS::selectionClear );
editFrame->PopTool( aEvent );
editFrame->PopTool( pushedEvent );
return false;
}
@ -844,7 +845,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
// Remove the dynamic ratsnest from the screen
m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest );
editFrame->PopTool( aEvent );
editFrame->PopTool( pushedEvent );
editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
return !restore_state;