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
This commit is contained in:
Jeff Young 2021-05-27 14:24:06 +01:00
parent 64cd401bdb
commit 42eae27551
2 changed files with 8 additions and 11 deletions

View File

@ -351,9 +351,6 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
} }
} }
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
selTool->RebuildSelection();
// Bitmaps are cached in Opengl: clear the cache, because // Bitmaps are cached in Opengl: clear the cache, because
// the cache data can be invalid // the cache data can be invalid
GetCanvas()->GetView()->RecacheAllItems(); GetCanvas()->GetView()->RecacheAllItems();
@ -383,6 +380,8 @@ void SCH_EDIT_FRAME::RollbackSchematicFromUndo()
UpdateHierarchyNavigator(); UpdateHierarchyNavigator();
TestDanglingEnds(); TestDanglingEnds();
m_toolManager->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
} }
SyncView(); SyncView();

View File

@ -1174,13 +1174,12 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
List->ReversePickersListOrder(); List->ReversePickersListOrder();
m_frame->PushCommandToRedoList( List ); m_frame->PushCommandToRedoList( List );
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selTool->RebuildSelection();
m_frame->SetSheetNumberAndCount(); m_frame->SetSheetNumberAndCount();
m_frame->TestDanglingEnds(); m_frame->TestDanglingEnds();
m_frame->OnPageSettingsChange(); m_frame->OnPageSettingsChange();
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
m_frame->SyncView(); m_frame->SyncView();
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
m_frame->OnModify(); m_frame->OnModify();
@ -1207,13 +1206,12 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
list->ReversePickersListOrder(); list->ReversePickersListOrder();
m_frame->PushCommandToUndoList( list ); m_frame->PushCommandToUndoList( list );
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selTool->RebuildSelection();
m_frame->SetSheetNumberAndCount(); m_frame->SetSheetNumberAndCount();
m_frame->TestDanglingEnds(); m_frame->TestDanglingEnds();
m_frame->OnPageSettingsChange(); m_frame->OnPageSettingsChange();
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->RebuildSelection();
m_frame->SyncView(); m_frame->SyncView();
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
m_frame->OnModify(); m_frame->OnModify();