mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Tie handler de-registration to window close
The handlers can't accept commands when the window is closed, which can be (far) earlier than the actual dtor of the frame Fixes https://gitlab.com/kicad/code/kicad/-/issues/19375
This commit is contained in:
parent
6c47f32ccf
commit
fb8d16439b
@ -439,12 +439,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
|
||||
SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
||||
{
|
||||
#ifdef KICAD_IPC_API
|
||||
Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
|
||||
wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
|
||||
&SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
|
||||
#endif
|
||||
|
||||
m_hierarchy->Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::OnResizeHierarchyNavigator, this );
|
||||
|
||||
// Ensure m_canvasType is up to date, to save it in config
|
||||
@ -1054,6 +1048,12 @@ void SCH_EDIT_FRAME::doCloseWindow()
|
||||
{
|
||||
SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
|
||||
|
||||
#ifdef KICAD_IPC_API
|
||||
Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
|
||||
wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
|
||||
&SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
|
||||
#endif
|
||||
|
||||
// Shutdown all running tools
|
||||
if( m_toolManager )
|
||||
m_toolManager->ShutdownAllTools();
|
||||
|
@ -569,12 +569,6 @@ PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
||||
delete m_eventCounterTimer;
|
||||
}
|
||||
|
||||
#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
|
||||
wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
|
||||
|
||||
@ -1198,6 +1192,12 @@ void PCB_EDIT_FRAME::doCloseWindow()
|
||||
|
||||
GetCanvas()->StopDrawing();
|
||||
|
||||
#ifdef KICAD_IPC_API
|
||||
Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
|
||||
wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED,
|
||||
&PCB_EDIT_FRAME::onPluginAvailabilityChanged, this );
|
||||
#endif
|
||||
|
||||
// Clean up mode-less dialogs.
|
||||
Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &PCB_EDIT_FRAME::onCloseModelessBookReporterDialogs,
|
||||
this );
|
||||
|
Loading…
x
Reference in New Issue
Block a user