Add RemoveAllListeners function for future addons

This commit is contained in:
Marek Roszko 2022-08-10 23:10:58 -04:00
parent cfb6fcf31a
commit 3e451ca516
3 changed files with 12 additions and 1 deletions

View File

@ -1966,6 +1966,12 @@ void BOARD::RemoveListener( BOARD_LISTENER* aListener )
} }
void BOARD::RemoveAllListeners()
{
m_listeners.clear();
}
void BOARD::OnItemChanged( BOARD_ITEM* aItem ) void BOARD::OnItemChanged( BOARD_ITEM* aItem )
{ {
InvokeListeners( &BOARD_LISTENER::OnBoardItemChanged, *this, aItem ); InvokeListeners( &BOARD_LISTENER::OnBoardItemChanged, *this, aItem );

View File

@ -1081,6 +1081,11 @@ public:
*/ */
void RemoveListener( BOARD_LISTENER* aListener ); void RemoveListener( BOARD_LISTENER* aListener );
/**
* Remove all listeners
*/
void RemoveAllListeners();
/** /**
* Notify the board and its listeners that an item on the board has * Notify the board and its listeners that an item on the board has
* been modified in some way. * been modified in some way.

View File

@ -448,7 +448,7 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
m_toolManager->ShutdownAllTools(); m_toolManager->ShutdownAllTools();
if( GetBoard() ) if( GetBoard() )
GetBoard()->RemoveListener( m_appearancePanel ); GetBoard()->RemoveAllListeners();
delete m_selectionFilterPanel; delete m_selectionFilterPanel;
delete m_appearancePanel; delete m_appearancePanel;