From 58cb35fe0178ab2ede898f68672fbc99b2eb737e Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Thu, 20 Jan 2011 06:05:52 +0000 Subject: [PATCH] Fix for the error Cannot Convert from charset Windows Japanese cp 932 caused by logwindow initializing the sjisconv in its constructor on systems which do not have the codepage installed (vlite) fixes issue 3659 git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6887 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/LogWindow.cpp | 15 +++++++++------ Source/Core/DolphinWX/Src/LogWindow.h | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index 3cba51a54e..cc8651424a 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -21,6 +21,7 @@ #include "IniFile.h" #include "FileUtil.h" #include "DebuggerUIUtil.h" +#include // Milliseconds between msgQueue flushes to wxTextCtrl #define UPDATETIME 200 @@ -48,12 +49,13 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos, , Parent(parent) , m_LogAccess(true) , m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL) , m_LogSection(1) -#ifdef _WIN32 - , m_SJISConv(wxFONTENCODING_SHIFT_JIS) -#else - , m_SJISConv(wxFONTENCODING_EUC_JP) -#endif { +#ifdef _WIN32 + m_SJISConv = new wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); +#else + m_SJISConv = new wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP)); +#endif + m_LogManager = LogManager::GetInstance(); for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) m_LogManager->addListener((LogTypes::LOG_TYPE)i, this); @@ -157,6 +159,7 @@ CLogWindow::~CLogWindow() } m_LogTimer->Stop(); delete m_LogTimer; + delete m_SJISConv; } void CLogWindow::OnClose(wxCloseEvent& event) @@ -537,6 +540,6 @@ void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text) m_LogSection.Enter(); if (msgQueue.size() >= 100) msgQueue.pop(); - msgQueue.push(std::pair((u8)level, wxString(text, m_SJISConv))); + msgQueue.push(std::pair((u8)level, wxString(text, *m_SJISConv))); m_LogSection.Leave(); } diff --git a/Source/Core/DolphinWX/Src/LogWindow.h b/Source/Core/DolphinWX/Src/LogWindow.h index 57db6e14f7..71b9f89ad7 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.h +++ b/Source/Core/DolphinWX/Src/LogWindow.h @@ -85,7 +85,7 @@ private: Common::CriticalSection m_LogSection; - wxCSConv m_SJISConv; + wxCSConv* m_SJISConv; DECLARE_EVENT_TABLE()