From a23c5a6f769cb5bb5005779dcf0916bfce045868 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 4 Oct 2015 13:44:10 +0100 Subject: [PATCH] Move MENU_ABOUT related objects into the MENU_ABOUT handler to avoid memory leaks. --- src/espeakedit.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/espeakedit.cpp b/src/espeakedit.cpp index f9a04639..4fe48840 100644 --- a/src/espeakedit.cpp +++ b/src/espeakedit.cpp @@ -559,23 +559,20 @@ void MyFrame::OnAbout(wxCommandEvent& event) char buf[300]; wxString url_docs; - wxBoxSizer *topsizer; - HtmlWindow *html; - wxDialog dlg(this, wxID_ANY, wxString(_("About"))); - - topsizer = new wxBoxSizer(wxVERTICAL); - switch(event.GetId()) { case MENU_ABOUT: { + wxDialog dlg(this, wxID_ANY, wxString(_("About"))); + sprintf(buf,about_string,espeak_Info(NULL)); - html = new HtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER); + HtmlWindow *html = new HtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER); html -> SetBorders(0); html -> SetPage(wxString(buf,wxConvLocal)); html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(), html -> GetInternalRepresentation() -> GetHeight()); + wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); topsizer -> Add(html, 1, wxALL, 10); //#if wxUSE_STATLINE