7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 21:29:17 +00:00

Move ownership of listener cleanup to BOARD itself

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19736
This commit is contained in:
JamesJCode 2025-01-27 21:55:11 +00:00
parent 25379b3094
commit 00e4d72d4b
2 changed files with 4 additions and 4 deletions

View File

@ -181,6 +181,9 @@ BOARD::~BOARD()
// cause call chains that query the containers
for( BOARD_ITEM* item : ownedItems )
delete item;
// Remove any listeners
RemoveAllListeners();
}

View File

@ -86,9 +86,6 @@ PCB_NET_INSPECTOR_PANEL::~PCB_NET_INSPECTOR_PANEL()
m_netsList->AssociateModel( nullptr );
if( m_brd != nullptr )
m_brd->RemoveListener( this );
// Disconnect from board events
m_frame->Unbind( EDA_EVT_UNITS_CHANGED, &PCB_NET_INSPECTOR_PANEL::onUnitsChanged, this );
@ -865,7 +862,7 @@ void PCB_NET_INSPECTOR_PANEL::OnBoardChanged()
{
m_brd = m_frame->GetBoard();
if( m_brd != nullptr )
if( m_brd )
m_brd->AddListener( this );
m_board_loaded = true;