From a0871d9c96c6d74631b47f7bc81fe367f9a237de Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 1 Feb 2021 20:39:32 -0500 Subject: [PATCH] prevent mem free issues on close --- gui/wxmain.cpp | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/gui/wxmain.cpp b/gui/wxmain.cpp index 5d14928..86807ab 100644 --- a/gui/wxmain.cpp +++ b/gui/wxmain.cpp @@ -222,33 +222,15 @@ MainFrame::MainFrame() : wxFrame(nullptr, wxID_ANY, "stmdspgui", wxPoint(50, 50) // Needs to clean things up void MainFrame::onCloseEvent(wxCloseEvent& event) { - //SetMenuBar(nullptr); - //delete m_menu_bar->Remove(2); - //delete m_menu_bar->Remove(1); - //delete m_menu_bar->Remove(0); - //delete m_menu_bar; - //delete m_measure_timer; - - //Unbind(wxEVT_TIMER, &MainFrame::onMeasureTimer, this, Id::MeasureTimer); - //Unbind(wxEVT_CLOSE_WINDOW, &MainFrame::onCloseEvent, this, wxID_ANY); - //Unbind(wxEVT_BUTTON, &MainFrame::onRunCompile, this, Id::MCodeCompile, wxID_ANY); - //Unbind(wxEVT_COMBOBOX, &MainFrame::onToolbarSampleRate, this, wxID_ANY, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onFileNew, this, Id::MFileNew, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onFileOpen, this, Id::MFileOpen, wxID_ANY); - ////menuFile->Append(MFileOpenTemplate, "Open &Template", loadTemplates()); - //Unbind(wxEVT_MENU, &MainFrame::onFileSave, this, Id::MFileSave, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onFileSaveAs, this, Id::MFileSaveAs, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onFileQuit, this, Id::MFileQuit, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunConnect, this, Id::MRunConnect, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunStart, this, Id::MRunStart, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunLogResults, this, Id::MRunLogResults, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunUpload, this, Id::MRunUpload, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunUnload, this, Id::MRunUnload, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunEditBSize, this, Id::MRunEditBSize, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunGenUpload, this, Id::MRunGenUpload, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunGenStart, this, Id::MRunGenStart, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onRunCompile, this, Id::MCodeCompile, wxID_ANY); - //Unbind(wxEVT_MENU, &MainFrame::onCodeDisassemble, this, Id::MCodeDisassemble, wxID_ANY); + SetMenuBar(nullptr); + delete m_menu_bar->Remove(2); + delete m_menu_bar->Remove(1); + delete m_menu_bar->Remove(0); + delete m_menu_bar; + delete m_measure_timer; + + Unbind(wxEVT_COMBOBOX, &MainFrame::onToolbarSampleRate, this, wxID_ANY, wxID_ANY); + Unbind(wxEVT_BUTTON, &MainFrame::onRunCompile, this, Id::MCodeCompile, wxID_ANY); event.Skip(); }