From 831d43885208b7ae971cfac28bd90175dc447b91 Mon Sep 17 00:00:00 2001 From: Petri Hodju Date: Mon, 13 May 2024 21:41:31 +0100 Subject: [PATCH] remove item from schematic's connection graph on destruction Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17961 (cherry picked from commit 4920c6b00be8b0b1e5386db15fefd6ec997f5214) --- eeschema/sch_item.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eeschema/sch_item.cpp b/eeschema/sch_item.cpp index e45862857e..fb937b0e82 100644 --- a/eeschema/sch_item.cpp +++ b/eeschema/sch_item.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,11 @@ SCH_ITEM::~SCH_ITEM() for( const auto& it : m_connection_map ) delete it.second; + + SCHEMATIC* sch = Schematic(); + + if( sch != nullptr ) + sch->ConnectionGraph()->RemoveItem( this ); }