Main: Make the wxLocale class member a unique_ptr

This commit is contained in:
Lioncash 2015-08-27 08:12:34 -04:00
parent 14ae1d23cf
commit 7fa0ecd046
2 changed files with 5 additions and 7 deletions

View File

@ -314,7 +314,7 @@ void DolphinApp::InitLanguageSupport()
// Load language if possible, fall back to system default otherwise // Load language if possible, fall back to system default otherwise
if (wxLocale::IsAvailable(language)) if (wxLocale::IsAvailable(language))
{ {
m_locale = new wxLocale(language); m_locale.reset(new wxLocale(language));
// Specify where dolphins *.gmo files are located on each operating system // Specify where dolphins *.gmo files are located on each operating system
#ifdef _WIN32 #ifdef _WIN32
@ -330,14 +330,13 @@ void DolphinApp::InitLanguageSupport()
if (!m_locale->IsOk()) if (!m_locale->IsOk())
{ {
wxMessageBox(_("Error loading selected language. Falling back to system default."), _("Error")); wxMessageBox(_("Error loading selected language. Falling back to system default."), _("Error"));
delete m_locale; m_locale.reset(new wxLocale(wxLANGUAGE_DEFAULT));
m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
} }
} }
else else
{ {
wxMessageBox(_("The selected language is not supported by your system. Falling back to system default."), _("Error")); wxMessageBox(_("The selected language is not supported by your system. Falling back to system default."), _("Error"));
m_locale = new wxLocale(wxLANGUAGE_DEFAULT); m_locale.reset(new wxLocale(wxLANGUAGE_DEFAULT));
} }
} }
@ -355,8 +354,6 @@ int DolphinApp::OnExit()
Core::Shutdown(); Core::Shutdown();
UICommon::Shutdown(); UICommon::Shutdown();
delete m_locale;
return wxApp::OnExit(); return wxApp::OnExit();
} }

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <memory>
#include <wx/app.h> #include <wx/app.h>
class CFrame; class CFrame;
@ -46,7 +47,7 @@ private:
wxString m_user_path; wxString m_user_path;
wxString m_file_to_load; wxString m_file_to_load;
wxString m_movie_file; wxString m_movie_file;
wxLocale* m_locale; std::unique_ptr<wxLocale> m_locale;
}; };
DECLARE_APP(DolphinApp); DECLARE_APP(DolphinApp);