diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index a4d223ad95..c75e53b976 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -314,7 +314,7 @@ void DolphinApp::InitLanguageSupport() // Load language if possible, fall back to system default otherwise 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 #ifdef _WIN32 @@ -330,14 +330,13 @@ void DolphinApp::InitLanguageSupport() if (!m_locale->IsOk()) { wxMessageBox(_("Error loading selected language. Falling back to system default."), _("Error")); - delete m_locale; - m_locale = new wxLocale(wxLANGUAGE_DEFAULT); + m_locale.reset(new wxLocale(wxLANGUAGE_DEFAULT)); } } else { 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(); UICommon::Shutdown(); - delete m_locale; - return wxApp::OnExit(); } diff --git a/Source/Core/DolphinWX/Main.h b/Source/Core/DolphinWX/Main.h index 005e8c6fc4..87dc6f4e4d 100644 --- a/Source/Core/DolphinWX/Main.h +++ b/Source/Core/DolphinWX/Main.h @@ -4,6 +4,7 @@ #pragma once +#include #include class CFrame; @@ -46,7 +47,7 @@ private: wxString m_user_path; wxString m_file_to_load; wxString m_movie_file; - wxLocale* m_locale; + std::unique_ptr m_locale; }; DECLARE_APP(DolphinApp);