Properly destroy cheat manager window when closed.

Fixes issue 4595.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7604 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2011-06-17 09:19:13 +00:00
parent 0fcf1d6197
commit ced315f677
2 changed files with 22 additions and 4 deletions

View File

@ -64,6 +64,7 @@ wxCheatsWindow::wxCheatsWindow(wxWindow* const parent)
wxCheatsWindow::~wxCheatsWindow()
{
main_frame->g_CheatsWindow = NULL;
::g_cheat_window = NULL;
}
void wxCheatsWindow::Init_ChildControls()
@ -135,6 +136,9 @@ void wxCheatsWindow::Init_ChildControls()
_connect_macro_(button_apply, wxCheatsWindow::OnEvent_ApplyChanges_Press, wxEVT_COMMAND_BUTTON_CLICKED, this);
wxButton* const button_cancel = new wxButton(panel, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize);
_connect_macro_(button_cancel, wxCheatsWindow::OnEvent_ButtonClose_Press, wxEVT_COMMAND_BUTTON_CLICKED, this);
Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(wxCheatsWindow::OnEvent_Close), (wxObject*)0, this);
wxStdDialogButtonSizer* const sButtons = new wxStdDialogButtonSizer();
sButtons->AddButton(button_apply);
sButtons->AddButton(button_cancel);
@ -248,9 +252,14 @@ CheatSearchTab::CheatSearchTab(wxWindow* const parent)
SetSizerAndFit(sizer_main);
}
void wxCheatsWindow::OnEvent_ButtonClose_Press(wxCommandEvent& ev)
void wxCheatsWindow::OnEvent_ButtonClose_Press(wxCommandEvent& WXUNUSED (event))
{
ev.Skip();
Close();
}
void wxCheatsWindow::OnEvent_Close(wxCloseEvent& ev)
{
Destroy();
}
void wxCheatsWindow::Load_ARCodes()
@ -578,8 +587,10 @@ CreateCodeDialog::CreateCodeDialog(wxWindow* const parent, const u32 address)
sizer_main->Add(sizer_value_label, 0, wxALL, 5);
sizer_main->Add(textctrl_value, 0, wxALL, 5);
sizer_main->Add(CreateButtonSizer(wxOK | wxCANCEL | wxNO_DEFAULT), 0, wxALL, 5);
Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CreateCodeDialog::PressOK));
Connect(wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CreateCodeDialog::PressCancel));
Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(CreateCodeDialog::OnEvent_Close), (wxObject*)0, this);
SetSizerAndFit(sizer_main);
SetFocus();
@ -626,10 +637,15 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev)
// refresh arcode list in other tab
::g_cheat_window->Load_ARCodes();
ev.Skip();
Close();
}
void CreateCodeDialog::PressCancel(wxCommandEvent& ev)
{
ev.Skip();
Close();
}
void CreateCodeDialog::OnEvent_Close(wxCloseEvent& ev)
{
Destroy();
}

View File

@ -55,6 +55,7 @@ protected:
void PressOK(wxCommandEvent&);
void PressCancel(wxCommandEvent&);
void OnEvent_Close(wxCloseEvent& ev);
};
class CheatSearchTab : public wxPanel
@ -151,6 +152,7 @@ class wxCheatsWindow : public wxDialog
// $ Close Button
void OnEvent_ButtonClose_Press(wxCommandEvent& event);
void OnEvent_Close(wxCloseEvent& ev);
// $ Cheats List
void OnEvent_CheatsList_ItemSelected(wxCommandEvent& event);