Don't leave a selection with a deleted item in it.

Fixes: lp:1803730
* https://bugs.launchpad.net/kicad/+bug/1803730
This commit is contained in:
Jeff Young 2018-11-19 15:55:08 +00:00
parent f71998b34e
commit 5bb5aea936
1 changed files with 13 additions and 1 deletions

View File

@ -246,12 +246,24 @@ int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
break; break;
} }
else if( evt->IsCancel() || TOOL_EVT_UTILS::IsCancelInteractive( *evt ) || evt->IsActivate() ) // This is a cancel-current-action (ie: <esc>).
// Note that this must go before IsCancelInteractive() as it also checks IsCancel().
else if( evt->IsCancel() )
{ {
// Clear current selection list to avoid selection of deleted items
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
commit.Revert(); commit.Revert();
break; break;
} }
// Now that cancel-current-action has been handled, check for cancel-tool.
else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
{
commit.Push( _( "Renumber pads" ) );
break;
}
else if( evt->IsClick( BUT_RIGHT ) ) else if( evt->IsClick( BUT_RIGHT ) )
{ {
m_menu.ShowContextMenu(); m_menu.ShowContextMenu();