mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
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.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user