Implement "fromOtherCommand" for PlaceModule() too.

Fixes https://gitlab.com/kicad/code/kicad/issues/5281
This commit is contained in:
Jeff Young 2020-08-21 23:23:22 +01:00
parent 80af7b3158
commit e92f58bb4f
1 changed files with 14 additions and 0 deletions

View File

@ -804,6 +804,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
VECTOR2I cursorPos = controls->GetCursorPosition();
bool reselect = false;
bool fromOtherCommand = module != nullptr;
// Prime the pump
if( module )
@ -828,6 +829,19 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
commit.Revert();
if( fromOtherCommand )
{
PICKED_ITEMS_LIST* undo = m_frame->PopCommandFromUndoList();
if( undo )
{
m_frame->PutDataInPreviousState( undo, false );
undo->ClearListAndDeleteItems();
delete undo;
}
}
module = NULL;
};