Don't continue until the move tool completes

Starting a new action (to add junctions) will break the move tool loop
and cancel placement.  We need to wait until the tool completes before
choosing where to place the junctions

Fixes https://gitlab.com/kicad/code/kicad/issues/7421
This commit is contained in:
Seth Hillbrand 2021-02-05 10:16:45 -08:00
parent 016bffc899
commit 2aa8a3724f
1 changed files with 12 additions and 2 deletions

View File

@ -959,15 +959,25 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
m_selectionTool->AddItemToSel( newItem );
if( performDrag )
{
m_toolMgr->RunAction( EE_ACTIONS::move, true );
SCH_MOVE_TOOL* moveTool = m_toolMgr->GetTool<SCH_MOVE_TOOL>();
// We cannot proceed until the move tool has ended (by placement or cancel) otherwise,
// we risk breaking out of the tool by activating another
while( moveTool->IsToolActive() )
Wait();
}
newItem->ClearFlags();
if( newItem->IsConnectable() )
{
auto selection = m_selectionTool->GetSelection();
EE_SELECTION new_sel = m_selectionTool->GetSelection();
new_sel.Add( newItem );
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selection );
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &new_sel );
m_frame->SchematicCleanUp();
m_frame->TestDanglingEnds();
}