mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
r6928 redux
removes memleak in exchange for 2 additional calls to ::IsValidCodePage git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6941 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -22,7 +22,6 @@
|
||||
#include "FileUtil.h"
|
||||
#include "DebuggerUIUtil.h"
|
||||
#include <wx/fontmap.h>
|
||||
#include "WxUtils.h"
|
||||
|
||||
// Milliseconds between msgQueue flushes to wxTextCtrl
|
||||
#define UPDATETIME 200
|
||||
@ -50,8 +49,18 @@ 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)
|
||||
, m_SJISConv(*(wxCSConv*)wxConvCurrent)
|
||||
{
|
||||
m_SJISConv = WxUtils::SJISConv();
|
||||
#ifdef _WIN32
|
||||
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
||||
if (validCP932)
|
||||
{
|
||||
m_SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS));
|
||||
}
|
||||
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
||||
#else
|
||||
m_SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_EUC_JP));
|
||||
#endif
|
||||
|
||||
m_LogManager = LogManager::GetInstance();
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
@ -156,7 +165,6 @@ CLogWindow::~CLogWindow()
|
||||
}
|
||||
m_LogTimer->Stop();
|
||||
delete m_LogTimer;
|
||||
delete m_SJISConv;
|
||||
}
|
||||
|
||||
void CLogWindow::OnClose(wxCloseEvent& event)
|
||||
@ -537,6 +545,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, wxString>((u8)level, wxString(text, *m_SJISConv)));
|
||||
msgQueue.push(std::pair<u8, wxString>((u8)level, wxString(text, m_SJISConv)));
|
||||
m_LogSection.Leave();
|
||||
}
|
||||
|
Reference in New Issue
Block a user