Merge pull request #2030 from lioncash/destroy

DolphinWX: Get rid of unnecessary Destroy calls
This commit is contained in:
Lioncash 2015-02-13 20:22:01 -05:00
commit 6558704403
5 changed files with 10 additions and 28 deletions

View File

@ -947,9 +947,8 @@ void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event)
#endif #endif
} }
InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"), 0); InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"));
m_ConfigFrame.ShowModal(); m_ConfigFrame.ShowModal();
m_ConfigFrame.Destroy();
// if game isn't running // if game isn't running
if (!was_init) if (!was_init)

View File

@ -412,17 +412,14 @@ void ControllerConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
Wiimote::Initialize(reinterpret_cast<void*>(GetHandle())); Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
#endif #endif
} }
InputConfigDialog m_ConfigFrame(this, *wiimote_plugin, _("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]); InputConfigDialog m_ConfigFrame(this, *wiimote_plugin, _("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
m_ConfigFrame.ShowModal(); m_ConfigFrame.ShowModal();
m_ConfigFrame.Destroy();
if (!was_init) // if game isn't running if (!was_init) // if game isn't running
{ {
Wiimote::Shutdown(); Wiimote::Shutdown();
} }
//InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, *Wiimote::GetConfig(), _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
//m_emu_config_diag->ShowModal();
//m_emu_config_diag->Destroy();
} }
void ControllerConfigDiag::RefreshRealWiimotes(wxCommandEvent&) void ControllerConfigDiag::RefreshRealWiimotes(wxCommandEvent&)
@ -569,13 +566,11 @@ void ControllerConfigDiag::OnGameCubeConfigButton(wxCommandEvent& event)
{ {
InputConfigDialog m_ConfigFrame(this, *key_plugin, _("GameCube Controller Configuration"), port_num); InputConfigDialog m_ConfigFrame(this, *key_plugin, _("GameCube Controller Configuration"), port_num);
m_ConfigFrame.ShowModal(); m_ConfigFrame.ShowModal();
m_ConfigFrame.Destroy();
} }
else else
{ {
InputConfigDialog m_ConfigFrame(this, *pad_plugin, _("GameCube Controller Configuration"), port_num); InputConfigDialog m_ConfigFrame(this, *pad_plugin, _("GameCube Controller Configuration"), port_num);
m_ConfigFrame.ShowModal(); m_ConfigFrame.ShowModal();
m_ConfigFrame.Destroy();
} }
// if game isn't running // if game isn't running

View File

@ -1349,14 +1349,12 @@ void CFrame::OnConfigControllers(wxCommandEvent& WXUNUSED (event))
{ {
ControllerConfigDiag config_dlg(this); ControllerConfigDiag config_dlg(this);
config_dlg.ShowModal(); config_dlg.ShowModal();
config_dlg.Destroy();
} }
void CFrame::OnConfigMenuCommands(wxCommandEvent& WXUNUSED(event)) void CFrame::OnConfigMenuCommands(wxCommandEvent& WXUNUSED(event))
{ {
HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this); HotkeyConfigDialog m_HotkeyDialog(this);
m_HotkeyDialog->ShowModal(); m_HotkeyDialog.ShowModal();
m_HotkeyDialog->Destroy();
// Update the GUI in case menu accelerators were changed // Update the GUI in case menu accelerators were changed
UpdateGUI(); UpdateGUI();
@ -1384,9 +1382,8 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED (event))
#endif #endif
} }
InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"), 0); InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"));
m_ConfigFrame.ShowModal(); m_ConfigFrame.ShowModal();
m_ConfigFrame.Destroy();
// if game isn't running // if game isn't running
if (!was_init) if (!was_init)

View File

@ -1079,13 +1079,7 @@ InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config
Center(); Center();
// live preview update timer // live preview update timer
m_update_timer = new wxTimer(this); m_update_timer.SetOwner(this);
Bind(wxEVT_TIMER, &InputConfigDialog::UpdateBitmaps, this); Bind(wxEVT_TIMER, &InputConfigDialog::UpdateBitmaps, this);
m_update_timer->Start(PREVIEW_UPDATE_TIME, wxTIMER_CONTINUOUS); m_update_timer.Start(PREVIEW_UPDATE_TIME, wxTIMER_CONTINUOUS);
}
bool InputConfigDialog::Destroy()
{
m_update_timer->Stop();
return true;
} }

View File

@ -23,6 +23,7 @@
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/timer.h>
#include <wx/translation.h> #include <wx/translation.h>
#include "InputCommon/ControllerEmu.h" #include "InputCommon/ControllerEmu.h"
@ -39,7 +40,6 @@ class wxSlider;
class wxStaticBitmap; class wxStaticBitmap;
class wxStaticText; class wxStaticText;
class wxTextCtrl; class wxTextCtrl;
class wxTimer;
class wxTimerEvent; class wxTimerEvent;
class wxWindow; class wxWindow;
@ -224,9 +224,6 @@ class InputConfigDialog : public wxDialog
{ {
public: public:
InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name, const int tab_num = 0); InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name, const int tab_num = 0);
//~InputConfigDialog();
bool Destroy() override;
void ClickSave(wxCommandEvent& event); void ClickSave(wxCommandEvent& event);
@ -241,5 +238,5 @@ private:
wxNotebook* m_pad_notebook; wxNotebook* m_pad_notebook;
std::vector<GamepadPage*> m_padpages; std::vector<GamepadPage*> m_padpages;
InputConfig& m_config; InputConfig& m_config;
wxTimer* m_update_timer; wxTimer m_update_timer;
}; };