Add more missing destructor event cleanups

This commit is contained in:
Marek Roszko 2023-10-02 07:22:00 -04:00
parent eaa3ee43e9
commit 6d3b846eb5
9 changed files with 58 additions and 6 deletions

View File

@ -75,8 +75,8 @@ PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aW
wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bMargins = new wxBoxSizer( wxVERTICAL );
wxSearchCtrl* filterSearch = CreateTextFilterBox( this, _( "Type filter text" ) );
bMargins->Add( filterSearch, 0, wxEXPAND, 0 );
m_filterSearch = CreateTextFilterBox( this, _( "Type filter text" ) );
bMargins->Add( m_filterSearch, 0, wxEXPAND, 0 );
m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( this, m_hotkeyStore, m_readOnly );
bMargins->Add( m_hotkeyListCtrl, 1, wxEXPAND, 0 );
@ -88,15 +88,22 @@ PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aW
#ifdef __WXGTK__
// Work around a bug that clips the text vertically in the wxSearchCtrl on GTK
filterSearch->SetMinSize( wxSize( filterSearch->GetSize().x,
int( filterSearch->GetSize().y * 1.6 ) ) );
m_filterSearch->SetMinSize(
wxSize( m_filterSearch->GetSize().x, int( m_filterSearch->GetSize().y * 1.6 ) ) );
#endif
SetSizer( mainSizer );
Layout();
// Connect Events
filterSearch->Bind( wxEVT_COMMAND_TEXT_UPDATED, &PANEL_HOTKEYS_EDITOR::OnFilterSearch, this );
m_filterSearch->Bind( wxEVT_COMMAND_TEXT_UPDATED, &PANEL_HOTKEYS_EDITOR::OnFilterSearch, this );
}
PANEL_HOTKEYS_EDITOR::~PANEL_HOTKEYS_EDITOR()
{
m_filterSearch->Unbind( wxEVT_COMMAND_TEXT_UPDATED, &PANEL_HOTKEYS_EDITOR::OnFilterSearch,
this );
}

View File

@ -72,6 +72,16 @@ DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES( SCH_EDIT_FRAME* aParent )
}
DIALOG_MIGRATE_BUSES::~DIALOG_MIGRATE_BUSES()
{
m_migration_list->Unbind( wxEVT_LIST_ITEM_SELECTED, &DIALOG_MIGRATE_BUSES::onItemSelected,
this );
m_btn_accept->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_MIGRATE_BUSES::onAcceptClicked,
this );
}
void DIALOG_MIGRATE_BUSES::loadGraphData()
{
m_items.clear();

View File

@ -49,6 +49,7 @@ class DIALOG_MIGRATE_BUSES : public DIALOG_MIGRATE_BUSES_BASE
public:
DIALOG_MIGRATE_BUSES( SCH_EDIT_FRAME* aParent );
~DIALOG_MIGRATE_BUSES();
private:

View File

@ -88,6 +88,12 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, SCH_SEARCH_DATA* aDat
}
DIALOG_SCH_FIND::~DIALOG_SCH_FIND()
{
Disconnect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_SCH_FIND::OnChar ), nullptr, this );
}
void DIALOG_SCH_FIND::OnClose( wxCloseEvent& aEvent )
{
// Notify the SCH_EDIT_FRAME

View File

@ -39,6 +39,7 @@ public:
DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, SCH_SEARCH_DATA* aData,
const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize, int aStyle = 0 );
~DIALOG_SCH_FIND();
void SetFindEntries( const wxArrayString& aEntries, const wxString& aFindString );
wxArrayString GetFindEntries() const;

View File

@ -36,12 +36,14 @@
class wxPanel;
class wxSizer;
class TOOL_MANAGER;
class wxSearchCtrl;
class PANEL_HOTKEYS_EDITOR : public RESETTABLE_PANEL
{
public:
PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow, bool aReadOnly );
~PANEL_HOTKEYS_EDITOR();
std::vector<TOOL_ACTION*>& ActionsList() { return m_actions; }
@ -84,6 +86,8 @@ private:
*/
void dumpHotkeys();
wxSearchCtrl* m_filterSearch;
protected:
EDA_BASE_FRAME* m_frame;
bool m_readOnly;

View File

@ -45,7 +45,7 @@ class DIALOG_PRINT_PCBNEW : public DIALOG_PRINT_GENERIC
{
public:
DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent, PCBNEW_PRINTOUT_SETTINGS* aSettings );
~DIALOG_PRINT_PCBNEW() {}
~DIALOG_PRINT_PCBNEW();
private:
enum
@ -127,6 +127,17 @@ DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent,
}
DIALOG_PRINT_PCBNEW::~DIALOG_PRINT_PCBNEW()
{
m_popMenu->Unbind( wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onPopUpLayers ), this,
ID_SELECT_FIRST, ID_SELECT_LAST );
m_outputMode->Unbind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeClicked,
this );
}
bool DIALOG_PRINT_PCBNEW::TransferDataToWindow()
{
if( !DIALOG_PRINT_GENERIC::TransferDataToWindow() )

View File

@ -451,6 +451,14 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, PRO
PANEL_FP_LIB_TABLE::~PANEL_FP_LIB_TABLE()
{
wxMenu* browseMenu = m_browseButton->GetSplitButtonMenu();
for( auto& [type, desc] : m_supportedFpFiles )
{
browseMenu->Unbind( wxEVT_COMMAND_MENU_SELECTED,
&PANEL_FP_LIB_TABLE::browseLibrariesHandler, this, type );
}
m_browseButton->Unbind( wxEVT_BUTTON, &PANEL_FP_LIB_TABLE::browseLibrariesHandler, this );
// Delete the GRID_TRICKS.
// Any additional event handlers should be popped before the window is deleted.
m_global_grid->PopEventHandler( true );

View File

@ -77,6 +77,10 @@ PANEL_SETUP_RULES::PANEL_SETUP_RULES( wxWindow* aParentWindow, PCB_EDIT_FRAME* a
PANEL_SETUP_RULES::~PANEL_SETUP_RULES( )
{
m_textEditor->Unbind( wxEVT_STC_CHARADDED, &PANEL_SETUP_RULES::onScintillaCharAdded, this );
m_textEditor->Unbind( wxEVT_STC_AUTOCOMP_CHAR_DELETED, &PANEL_SETUP_RULES::onScintillaCharAdded,
this );
m_textEditor->Unbind( wxEVT_CHAR_HOOK, &PANEL_SETUP_RULES::onCharHook, this );
Pgm().GetCommonSettings()->m_Appearance.text_editor_zoom = m_textEditor->GetZoom();
delete m_scintillaTricks;