Fixed crash caused by using a char pointer to a temporary string only (which can get

overwritten/freed before the pointer is used).
This commit is contained in:
hiker 2015-10-19 13:29:52 +11:00
parent 06fb6d4eb2
commit 52b5b7c8d1

View File

@ -145,8 +145,8 @@ void SpinnerWidget::add()
else else
{ {
rect<s32> subsize_label = rect<s32>(m_h, 0, m_w - m_h, m_h); rect<s32> subsize_label = rect<s32>(m_h, 0, m_w - m_h, m_h);
const wchar_t *text = stringw(m_value).c_str(); stringw text = stringw(m_value);
IGUIStaticText* label = GUIEngine::getGUIEnv()->addStaticText(text, subsize_label, IGUIStaticText* label = GUIEngine::getGUIEnv()->addStaticText(text.c_str(), subsize_label,
false /* border */, true /* word wrap */, false /* border */, true /* word wrap */,
btn, getNewNoFocusID()); btn, getNewNoFocusID());
m_children[1].m_element = label; m_children[1].m_element = label;