IPC_API: fix crash in PLUGIN_AVAILABILITY_CHANGED event handler

This commit is contained in:
qu1ck 2024-04-05 17:49:51 -07:00
parent c6e784dae3
commit 441b2686d3
No known key found for this signature in database
2 changed files with 16 additions and 6 deletions

View File

@ -268,12 +268,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
#ifdef KICAD_IPC_API
wxTheApp->Bind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
[&]( wxCommandEvent& aEvt )
{
wxLogTrace( traceApi, "PCB frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
ReCreateHToolbar();
aEvt.Skip();
} );
&PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
#endif
m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
@ -539,6 +534,8 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
#ifdef KICAD_IPC_API
Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
&PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
#endif
// Close modeless dialogs
@ -2630,3 +2627,12 @@ void PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs( wxCommandEvent& aEvent
m_footprintDiffDlg = nullptr;
}
}
#ifdef KICAD_IPC_API
void PCB_EDIT_FRAME::onPluginAvailabilityChanged( wxCommandEvent& aEvt )
{
wxLogTrace( traceApi, "PCB frame: EDA_EVT_PLUGIN_AVAILABILITY_CHANGED" );
ReCreateHToolbar();
aEvt.Skip();
}
#endif

View File

@ -823,6 +823,10 @@ protected:
void onCloseModelessBookReporterDialogs( wxCommandEvent& aEvent );
#ifdef KICAD_IPC_API
void onPluginAvailabilityChanged( wxCommandEvent& aEvt );
#endif
public:
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer