Check item before concluding that ConvertText has run.

Otherwise we set item from nullptr back to the selection, and then
we think we're dragging again which causes all kinds of grief.

Fixes: lp:1828067
* https://bugs.launchpad.net/kicad/+bug/1828067
This commit is contained in:
Jeff Young 2019-05-10 16:05:28 +01:00
parent e77d096412
commit 7da2631b27
4 changed files with 5 additions and 5 deletions

View File

@ -264,7 +264,7 @@ int LIB_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
m_toolMgr->RunAction( SCH_ACTIONS::addItemsToSel, true, &newItems );
m_toolMgr->RunAction( SCH_ACTIONS::move, true );
m_toolMgr->RunAction( SCH_ACTIONS::move, false );
return 0;
}
@ -585,7 +585,7 @@ int LIB_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
m_toolMgr->RunAction( SCH_ACTIONS::addItemsToSel, true, &newItems );
m_toolMgr->RunAction( SCH_ACTIONS::move, true );
m_toolMgr->RunAction( SCH_ACTIONS::move, false );
return 0;
}

View File

@ -727,7 +727,7 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
else if( item && TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
{
// This happens if our text was replaced out from under us by ConvertTextType()
SELECTION& selection = m_selectionTool->GetSelection();

View File

@ -849,7 +849,7 @@ int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
m_toolMgr->RunAction( SCH_ACTIONS::addItemsToSel, true, &newItems );
m_toolMgr->RunAction( SCH_ACTIONS::move );
m_toolMgr->RunAction( SCH_ACTIONS::move, false );
return 0;
}

View File

@ -655,7 +655,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
SCH_ITEM* item = (SCH_ITEM*) selection.GetTopLeftItem();
selection.SetReferencePoint( item->GetPosition() );
m_toolMgr->RunAction( SCH_ACTIONS::move, true );
m_toolMgr->RunAction( SCH_ACTIONS::move, false );
}
return 0;