From a901247cbdbb5351d6bf670a1659b254844a5319 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 23 Jun 2023 22:10:04 +0100 Subject: [PATCH] Rebuilding connectivity must be done after changes are committed. It also needs to be done after undo and redo. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15028 --- eeschema/sch_commit.cpp | 11 ++++++----- eeschema/tools/sch_editor_control.cpp | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_commit.cpp b/eeschema/sch_commit.cpp index 750a6969ee..105d363982 100644 --- a/eeschema/sch_commit.cpp +++ b/eeschema/sch_commit.cpp @@ -214,8 +214,6 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) std::vector bulkRemovedItems; std::vector itemsChanged; - frame->RecalculateConnections( this, NO_CLEANUP ); - for( COMMIT_LINE& ent : m_changes ) { int changeType = ent.m_type & CHT_TYPE; @@ -321,6 +319,12 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) } } + if( frame ) + { + frame->RecalculateConnections( this, NO_CLEANUP ); + frame->TestDanglingEnds(); + } + if( schematic ) { if( bulkAddedItems.size() > 0 ) @@ -347,9 +351,6 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) if( selectedModified ) m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); - if( frame ) - frame->TestDanglingEnds(); - if( !( aCommitFlags & SKIP_SET_DIRTY ) ) { if( frame ) diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 63ceb50bba..8bbecba393 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -1215,6 +1215,7 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent ) m_frame->PutDataInPreviousState( undo_list ); m_frame->SetSheetNumberAndCount(); + m_frame->RecalculateConnections( nullptr, NO_CLEANUP ); m_frame->TestDanglingEnds(); // Now push the old command to the RedoList @@ -1249,6 +1250,7 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent ) m_frame->PushCommandToUndoList( list ); m_frame->SetSheetNumberAndCount(); + m_frame->RecalculateConnections( nullptr, NO_CLEANUP ); m_frame->TestDanglingEnds(); m_toolMgr->GetTool()->RebuildSelection();