Fixed crash after multiple 'cut' commands in the footprint editor

When multiple cut commands were issued, the cut command handler would
restart multiple times and keep running until the handler that was
invoked first finishes. As all handlers kept a selection copy, they
would try to save the deleted items to the clipboard resulting in a
crash.

Fixes: lp:1761221
* https://bugs.launchpad.net/kicad/+bug/1761221
This commit is contained in:
Maciej Suminski 2018-04-05 00:03:34 +02:00
parent 6fb47faebd
commit 94dbcc7199
2 changed files with 6 additions and 6 deletions

View File

@ -1342,17 +1342,17 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
std::vector<MSG_PANEL_ITEM> msgItems = { item1 };
SELECTION selection = m_selectionTool->RequestSelection();
SELECTION& selection = m_selectionTool->RequestSelection();
if( selection.Empty() )
return 0;
return 1;
frame()->SetMsgPanel( msgItems );
bool rv = pickCopyReferencePoint( refPoint );
frame()->SetMsgPanel( board() );
if( !rv )
return 0;
return 1;
selection.SetReferencePoint( refPoint );
io.SetBoard( board() );
@ -1364,7 +1364,8 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
int EDIT_TOOL::cutToClipboard( const TOOL_EVENT& aEvent )
{
copyToClipboard( aEvent );
Remove( aEvent );
if( !copyToClipboard( aEvent ) )
Remove( aEvent );
return 0;
}

View File

@ -77,7 +77,6 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
setControls();
while( OPT_TOOL_EVENT evt = Wait() )
{
auto mousePos = controls->GetMousePosition();