Fixed the TOOL_STATE::idle field setting condition

The tools were being set as idle, whenever an event handler execution
finished (via TOOL_MANAGER::finishTool()). Such approach does not take
into account cases when a tool is active and receives an event causing
another event handler of the same tool to run. When this happend, the
tool has been incorrectly set as idle when the second handler finished
its execution.

In a particular case, invoking the router settings dialog caused the PNS
router to be incorrectly detected as inactive in
EDIT_TOOL::invokeInlineRouter(). Due to that, ROUTER_TOOL::CanInlineDrag()
requested a selection that required disambiguation menu for items
that were modified by the router, but not yet committed. After the drag
tool had finished, the disambiguation menu was eventually shown
with items existing only in the undo buffer. Removing such item lead to
track DLIST corruption, effectively erasing all tracks.

Fixes: lp:1767826
* https://bugs.launchpad.net/kicad/+bug/1767826
This commit is contained in:
Maciej Suminski 2018-05-17 16:04:52 +02:00
parent 7c52af2d50
commit dfcdfe91fa
1 changed files with 2 additions and 2 deletions

View File

@ -750,6 +750,8 @@ TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState )
// Deactivate the tool if there are no other contexts saved on the stack
if( it != m_activeTools.end() )
it = m_activeTools.erase( it );
aState->idle = true;
}
if( aState == m_activeState )
@ -761,8 +763,6 @@ TOOL_MANAGER::ID_LIST::iterator TOOL_MANAGER::finishTool( TOOL_STATE* aState )
if( tool->GetType() == INTERACTIVE )
static_cast<TOOL_INTERACTIVE*>( tool )->resetTransitions();
aState->idle = true;
return it;
}