Fix memory leak in guiConfirmRegistration
This commit is contained in:
parent
738c8b102b
commit
53dd781927
@ -99,9 +99,10 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
|||||||
snprintf(info_text_buf, sizeof(info_text_buf), info_text_template.c_str(),
|
snprintf(info_text_buf, sizeof(info_text_buf), info_text_template.c_str(),
|
||||||
address.c_str(), m_playername.c_str());
|
address.c_str(), m_playername.c_str());
|
||||||
|
|
||||||
gui::IGUIEditBox *e = new gui::intlGUIEditBox(
|
wchar_t *info_text_buf_wide = utf8_to_wide_c(info_text_buf);
|
||||||
utf8_to_wide_c(info_text_buf), true, Environment, this,
|
gui::IGUIEditBox *e = new gui::intlGUIEditBox(info_text_buf_wide, true,
|
||||||
ID_message, rect2, false, true);
|
Environment, this, ID_message, rect2, false, true);
|
||||||
|
delete[] info_text_buf_wide;
|
||||||
e->drop();
|
e->drop();
|
||||||
e->setMultiLine(true);
|
e->setMultiLine(true);
|
||||||
e->setWordWrap(true);
|
e->setWordWrap(true);
|
||||||
|
@ -167,6 +167,8 @@ std::string wide_to_utf8(const std::wstring &input)
|
|||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
// You must free the returned string!
|
||||||
|
// The returned string is allocated using new
|
||||||
wchar_t *utf8_to_wide_c(const char *str)
|
wchar_t *utf8_to_wide_c(const char *str)
|
||||||
{
|
{
|
||||||
std::wstring ret = utf8_to_wide(std::string(str));
|
std::wstring ret = utf8_to_wide(std::string(str));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user