Prevent crashes when canceling duplication
Duplicating multiple footprints, moving and then pressing Esc could crash when we attempt to re-select the original items. This allows bypassing the issue when running from the duplication tool
This commit is contained in:
parent
f1029b7280
commit
292492bd01
|
@ -732,7 +732,7 @@ int EDIT_TOOL::MoveWithReference( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
// Note: aEvent MUST NOT be const&; the source will get de-allocated if we go into the picker's
|
// Note: aEvent MUST NOT be const&; the source will get de-allocated if we go into the picker's
|
||||||
// event loop.
|
// event loop.
|
||||||
int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference, bool aReselect )
|
||||||
{
|
{
|
||||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||||
|
@ -1124,7 +1124,11 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
||||||
// Unselect all items to clear selection flags and then re-select the originally selected
|
// Unselect all items to clear selection flags and then re-select the originally selected
|
||||||
// items.
|
// items.
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items );
|
|
||||||
|
// In the case where the original items are temporary, we don't want to reselect
|
||||||
|
// as the items may be invalidated by the Revert above
|
||||||
|
if( !restore_state || aReselect )
|
||||||
|
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items );
|
||||||
|
|
||||||
editFrame->PopTool( tool );
|
editFrame->PopTool( tool );
|
||||||
editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
@ -2254,7 +2258,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||||
// If items were duplicated, pick them up
|
// If items were duplicated, pick them up
|
||||||
// this works well for "dropping" copies around and pushes the commit
|
// this works well for "dropping" copies around and pushes the commit
|
||||||
TOOL_EVENT evt = PCB_ACTIONS::move.MakeEvent();
|
TOOL_EVENT evt = PCB_ACTIONS::move.MakeEvent();
|
||||||
Move( evt );
|
doMoveSelection( evt, false, false );
|
||||||
|
|
||||||
// Deslect the duplicated item if we originally started as a hover selection
|
// Deslect the duplicated item if we originally started as a hover selection
|
||||||
if( is_hover )
|
if( is_hover )
|
||||||
|
|
|
@ -180,7 +180,7 @@ private:
|
||||||
bool invokeInlineRouter( int aDragMode );
|
bool invokeInlineRouter( int aDragMode );
|
||||||
bool isRouterActive() const;
|
bool isRouterActive() const;
|
||||||
|
|
||||||
int doMoveSelection( TOOL_EVENT aEvent, bool aPickReference = false );
|
int doMoveSelection( TOOL_EVENT aEvent, bool aPickReference = false, bool aReselect = true );
|
||||||
|
|
||||||
bool pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage,
|
bool pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage,
|
||||||
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint );
|
const wxString& aCanceledMessage, VECTOR2I& aReferencePoint );
|
||||||
|
|
Loading…
Reference in New Issue