From 019921cb4873fc3d3df17a3a9c67be23fff636db Mon Sep 17 00:00:00 2001 From: JamesJCode <13408010-JamesJCode@users.noreply.gitlab.com> Date: Mon, 5 May 2025 22:17:57 +0100 Subject: [PATCH] Add new CONNECTIVITY_CANDIDATE flag We reuse the CANDIDATE flag in various places across the codebase, which is probably incorrect given the original intention for the flag. Clearing it before use would be a performance hit for incremental connectivity - and we can't rely on other users of the flag to clear it for us. So we now use a new flag just for connectivity to avoid other users trampling on connectivity updates. --- eeschema/connection_graph.cpp | 8 ++++---- include/eda_item.h | 3 ++- include/eda_item_flags.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 6907f92435..189531756e 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -1450,10 +1450,10 @@ void CONNECTION_GRAPH::buildItemSubGraphs() [&]( SCH_ITEM* aItem ) -> bool { SCH_CONNECTION* conn = aItem->GetOrInitConnection( sheet, this ); - bool unique = !( aItem->GetFlags() & CANDIDATE ); + bool unique = !( aItem->GetFlags() & CONNECTIVITY_CANDIDATE ); if( conn && !conn->SubgraphCode() ) - aItem->SetFlags( CANDIDATE ); + aItem->SetFlags( CONNECTIVITY_CANDIDATE ); return ( unique && conn && ( conn->SubgraphCode() == 0 ) ); }; @@ -1480,7 +1480,7 @@ void CONNECTION_GRAPH::buildItemSubGraphs() for( SCH_ITEM* citem : citemset ) { - if( citem->HasFlag( CANDIDATE ) ) + if( citem->HasFlag( CONNECTIVITY_CANDIDATE ) ) continue; if( get_items( citem ) ) @@ -1490,7 +1490,7 @@ void CONNECTION_GRAPH::buildItemSubGraphs() } for( SCH_ITEM* connected_item : memberlist ) - connected_item->ClearFlags( CANDIDATE ); + connected_item->ClearFlags( CONNECTIVITY_CANDIDATE ); subgraph->m_dirty = true; m_subgraphs.push_back( subgraph ); diff --git a/include/eda_item.h b/include/eda_item.h index 0c710def2b..f4e73388a7 100644 --- a/include/eda_item.h +++ b/include/eda_item.h @@ -156,7 +156,8 @@ public: EDA_ITEM_FLAGS GetTempFlags() const { - constexpr int mask = ( CANDIDATE | SELECTED_BY_DRAG | IS_LINKED | SKIP_STRUCT | SELECTION_CANDIDATE ); + constexpr int mask = ( CANDIDATE | SELECTED_BY_DRAG | IS_LINKED | SKIP_STRUCT | SELECTION_CANDIDATE + | CONNECTIVITY_CANDIDATE ); return m_flags & mask; } diff --git a/include/eda_item_flags.h b/include/eda_item_flags.h index f04f96cfb3..cf98f04249 100644 --- a/include/eda_item_flags.h +++ b/include/eda_item_flags.h @@ -60,7 +60,7 @@ #define ROUTER_TRANSIENT (1 << 22) ///< transient items that should NOT be cached -// 23 is unused +#define CONNECTIVITY_CANDIDATE ( 1 << 23 ) ///< flag indicating that the structure is connected for connectivity #define HOLE_PROXY (1 << 24) ///< Indicates the BOARD_ITEM is a proxy for its hole #define SHOW_ELEC_TYPE (1 << 25) ///< Show pin electrical type