Make sure that we are disconnected before dtor

The child class removes itself from the parent panel, which calls the
DTOR.  This automatically disconnects the events, so if we want to
explicitly do this, we need to do it before freeing the memory

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21307
This commit is contained in:
Seth Hillbrand 2025-07-12 12:07:56 -07:00
parent b165240118
commit 8b62eac886

View File

@ -604,11 +604,10 @@ PANEL_COMPONENT_CLASS_CONDITION_REFERENCE::PANEL_COMPONENT_CLASS_CONDITION_REFER
void PANEL_COMPONENT_CLASS_CONDITION_REFERENCE::OnDeleteConditionClick( wxCommandEvent& event )
{
m_panelParent->RemoveCondition( this );
Disconnect( wxEVT_MENU,
wxCommandEventHandler( PANEL_COMPONENT_CLASS_CONDITION_REFERENCE::onMenu ), nullptr,
this );
m_panelParent->RemoveCondition( this );
}