diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 8d95e628e4..d0d2b19e4d 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -1182,35 +1182,21 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent ) m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } ); // Get the old list - PICKED_ITEMS_LIST* List = m_frame->PopCommandFromUndoList(); - size_t num_undos = m_frame->m_undoList.m_CommandsList.size(); - - // The cleanup routines normally run after an operation and so attempt to append their - // undo items onto the operation's list. However, in this case that's going be the list - // under us, which we don't want, so we push a dummy list onto the stack. - PICKED_ITEMS_LIST* dummy = new PICKED_ITEMS_LIST(); - m_frame->PushCommandToUndoList( dummy ); - - m_frame->PutDataInPreviousState( List ); + PICKED_ITEMS_LIST* undo_list = m_frame->PopCommandFromUndoList(); + m_frame->PutDataInPreviousState( undo_list ); m_frame->SetSheetNumberAndCount(); m_frame->TestDanglingEnds(); - m_frame->OnPageSettingsChange(); - - // The cleanup routines *should* have appended to our dummy list, but just to be doubly - // sure pop any other new lists off the stack as well - while( m_frame->m_undoList.m_CommandsList.size() > num_undos ) - delete m_frame->PopCommandFromUndoList(); // Now push the old command to the RedoList - List->ReversePickersListOrder(); - m_frame->PushCommandToRedoList( List ); + undo_list->ReversePickersListOrder(); + m_frame->PushCommandToRedoList( undo_list ); m_toolMgr->GetTool()->RebuildSelection(); m_frame->SyncView(); - m_frame->GetCanvas()->Refresh(); m_frame->OnModify(); + m_frame->OnPageSettingsChange(); return 0; }