remove item from schematic's connection graph on destruction

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17961

(cherry picked from commit 4920c6b00b)
This commit is contained in:
Petri Hodju 2024-05-13 21:41:31 +01:00 committed by Jeff Young
parent a9b5b1728a
commit 831d438852
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <schematic.h>
#include <connection_graph.h>
#include <trace_helpers.h>
#include <general.h>
#include <netclass.h>
@ -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 );
}