From 94470f7da66bc39034df329228f1fbac4d85ab4a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 12 Apr 2019 19:46:12 -0700 Subject: [PATCH] eeschema: Avoid modifying the schematic in undo OnModify() is called when staging the undo/redo modifications. This requires that it not create changes that themselves need to be placed in the undo/redo stack --- eeschema/sch_edit_frame.cpp | 11 +++++++---- eeschema/sch_edit_frame.h | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 06cf445a89..aad99e0238 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -798,7 +798,7 @@ void SCH_EDIT_FRAME::OnModify() if( ADVANCED_CFG::GetCfg().m_realTimeConnectivity ) - RecalculateConnections(); + RecalculateConnections( false ); m_canvas->Refresh(); } @@ -1476,15 +1476,18 @@ void SCH_EDIT_FRAME::UpdateTitle() } -void SCH_EDIT_FRAME::RecalculateConnections() +void SCH_EDIT_FRAME::RecalculateConnections( bool aDoCleanup ) { SCH_SHEET_LIST list( g_RootSheet ); PROF_COUNTER timer; // Ensure schematic graph is accurate - for( const auto& sheet : list ) - SchematicCleanUp( false, sheet.LastScreen() ); + if( aDoCleanup ) + { + for( const auto& sheet : list ) + SchematicCleanUp( false, sheet.LastScreen() ); + } timer.Stop(); wxLogTrace( "CONN_PROFILE", "SchematicCleanUp() %0.4f ms", timer.msecs() ); diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 3b4182c1b4..1c39c949d5 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -517,7 +517,7 @@ public: * @param aScreen is the screen to examine, or nullptr to examine the current screen * @return True if any wires or buses were broken. */ - bool BreakSegmentsOnJunctions( bool aApped = false, + bool BreakSegmentsOnJunctions( bool aAppend = false, SCH_SCREEN* aScreen = nullptr ); /** @@ -1557,7 +1557,7 @@ public: /** * Generates the connection data for the entire schematic hierarchy. */ - void RecalculateConnections(); + void RecalculateConnections( bool aDoCleanup = true ); void SetCurrentSheet( SCH_SHEET_PATH *aSheet );