Fix segfault in LogWindow on Mac
Commit 9ddb67d4a9
seems to have
introduced a segfault on Mac. The issue is that it this change casts
wxConvCurrent (which is a wxMBConvLibc) to a wxCSConv. This is an
unsafe cast because wxCSConv has member variables, but wxMBConvLibc
does not.
In LogWindow.cpp, the constructor for m_SJISConv is dereferencing one
of those member variables, which is a dereference of uninitialized
memory!
This CL reverts to the older (non-crashing) constructor, but keeps the
behavior the same.
This commit is contained in:
parent
ed3f9ce288
commit
d6d52920ec
|
@ -41,7 +41,7 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
|||
, x(0), y(0), winpos(0)
|
||||
, Parent(parent), m_ignoreLogTimer(false), m_LogAccess(true)
|
||||
, m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL)
|
||||
, m_SJISConv(*(wxCSConv*)wxConvCurrent)
|
||||
, m_SJISConv(wxT(""))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
static bool validCP932 = ::IsValidCodePage(932) != 0;
|
||||
|
@ -52,6 +52,7 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
|
|||
else
|
||||
{
|
||||
WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932");
|
||||
m_SJISConv = *(wxCSConv*)wxConvCurrent;
|
||||
}
|
||||
#else
|
||||
// on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)
|
||||
|
|
Loading…
Reference in New Issue