From 892bbdade669def297b0469509dd648fef6478bd Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 11 Nov 2014 09:50:11 -0500 Subject: DolphinWX: Eliminate some memory leaks Since the menus aren't actually assigned a parent, they would not be freed by wx. Plus, these should have initially been constructed on the stack in the first place. Technically any time someone right-clicked the game list they would be leaking memory. --- Source/Core/DolphinWX/FrameAui.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Source/Core/DolphinWX/FrameAui.cpp') diff --git a/Source/Core/DolphinWX/FrameAui.cpp b/Source/Core/DolphinWX/FrameAui.cpp index 43e3f86043..cfabde869d 100644 --- a/Source/Core/DolphinWX/FrameAui.cpp +++ b/Source/Core/DolphinWX/FrameAui.cpp @@ -333,21 +333,21 @@ void CFrame::OnTab(wxAuiNotebookEvent& event) if (!g_pCodeWindow) return; // Create the popup menu - wxMenu* MenuPopup = new wxMenu; + wxMenu MenuPopup; - wxMenuItem* Item = new wxMenuItem(MenuPopup, wxID_ANY, _("Select floating windows")); - MenuPopup->Append(Item); + wxMenuItem* Item = new wxMenuItem(&MenuPopup, wxID_ANY, _("Select floating windows")); + MenuPopup.Append(Item); Item->Enable(false); - MenuPopup->Append(new wxMenuItem(MenuPopup)); + MenuPopup.Append(new wxMenuItem(&MenuPopup)); for (int i = IDM_LOGWINDOW; i <= IDM_CODEWINDOW; i++) { wxWindow *Win = FindWindowById(i); if (Win && Win->IsEnabled()) { - Item = new wxMenuItem(MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW, + Item = new wxMenuItem(&MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW, Win->GetName(), "", wxITEM_CHECK); - MenuPopup->Append(Item); + MenuPopup.Append(Item); Item->Check(!!FindWindowById(i + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW)); } } @@ -357,7 +357,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event) Pt = ScreenToClient(Pt); // Show - PopupMenu(MenuPopup, Pt); + PopupMenu(&MenuPopup, Pt); } void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event) -- cgit v1.2.3