mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-27 06:35:39 +00:00
Fix segfault in LogWindow on Mac
Commit 9ddb67d4a96a53698a71a7f3c8936c2437dd81de 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…
x
Reference in New Issue
Block a user