diff --git a/pcbnew/drc/drc_creepage_utils.h b/pcbnew/drc/drc_creepage_utils.h index 0c977b3322..70be2c6071 100644 --- a/pcbnew/drc/drc_creepage_utils.h +++ b/pcbnew/drc/drc_creepage_utils.h @@ -697,11 +697,29 @@ public: ~CREEPAGE_GRAPH() { for( CREEP_SHAPE* cs : m_shapeCollection ) + { if( cs ) { delete cs; cs = nullptr; } + } + + // Clear out the circular shared pointer references + for( std::shared_ptr<GRAPH_NODE>& n : m_nodes ) + { + if( n ) + { + n->m_node_conns.clear(); + n = nullptr; + } + } + + for( std::shared_ptr<GRAPH_CONNECTION>& c : m_connections ) + { + if( c ) + c = nullptr; + } };