From 42eae275514d01979a97c59367b433114c6fb5d6 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 27 May 2021 14:24:06 +0100 Subject: [PATCH] Rebuild selection after heavy lifting. Undo does some fairly major redraws (including setting the current screen), all of which drop the selection and cancel interactive tools. Make sure the selection is re-built *after* all those run. Fixes https://gitlab.com/kicad/code/kicad/issues/8492 --- eeschema/schematic_undo_redo.cpp | 5 ++--- eeschema/tools/sch_editor_control.cpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index eb0ea3ae4b..ea35cd36d7 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -351,9 +351,6 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList ) } } - EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); - selTool->RebuildSelection(); - // Bitmaps are cached in Opengl: clear the cache, because // the cache data can be invalid GetCanvas()->GetView()->RecacheAllItems(); @@ -383,6 +380,8 @@ void SCH_EDIT_FRAME::RollbackSchematicFromUndo() UpdateHierarchyNavigator(); TestDanglingEnds(); + + m_toolManager->GetTool()->RebuildSelection(); } SyncView(); diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 8e6d57da04..b1d65ff23e 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -1174,13 +1174,12 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent ) List->ReversePickersListOrder(); m_frame->PushCommandToRedoList( List ); - EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool(); - selTool->RebuildSelection(); - m_frame->SetSheetNumberAndCount(); m_frame->TestDanglingEnds(); - m_frame->OnPageSettingsChange(); + + m_toolMgr->GetTool()->RebuildSelection(); + m_frame->SyncView(); m_frame->GetCanvas()->Refresh(); m_frame->OnModify(); @@ -1207,13 +1206,12 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent ) list->ReversePickersListOrder(); m_frame->PushCommandToUndoList( list ); - EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool(); - selTool->RebuildSelection(); - m_frame->SetSheetNumberAndCount(); m_frame->TestDanglingEnds(); - m_frame->OnPageSettingsChange(); + + m_toolMgr->GetTool()->RebuildSelection(); + m_frame->SyncView(); m_frame->GetCanvas()->Refresh(); m_frame->OnModify();