Fix gettext memory leaks

master
sapier 2013-05-09 23:14:32 +02:00 committed by PilzAdam
parent ee1155fe6d
commit d859ad7ed7
1 changed files with 12 additions and 4 deletions

View File

@ -483,16 +483,20 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 390, 20); core::rect<s32> rect(0, 0, 390, 20);
rect += m_topleft_client + v2s32(50, 10); rect += m_topleft_client + v2s32(50, 10);
Environment->addStaticText(wgettext("Favorites:"), wchar_t* text = wgettext("Favorites:");
Environment->addStaticText(text,
rect, false, true, this, GUI_ID_SERVERLIST_TITLE); rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
delete[] text;
} }
} else { } else {
m_data->servers = ServerList::getOnline(); m_data->servers = ServerList::getOnline();
{ {
core::rect<s32> rect(0, 0, 390, 20); core::rect<s32> rect(0, 0, 390, 20);
rect += m_topleft_client + v2s32(50, 10); rect += m_topleft_client + v2s32(50, 10);
Environment->addStaticText(wgettext("Public Server List:"), wchar_t* text = wgettext("Public Server List:");
Environment->addStaticText(text,
rect, false, true, this, GUI_ID_SERVERLIST_TITLE); rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
delete[] text;
} }
} }
#else #else
@ -500,8 +504,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
{ {
core::rect<s32> rect(0, 0, 390, 20); core::rect<s32> rect(0, 0, 390, 20);
rect += m_topleft_client + v2s32(50, 10); rect += m_topleft_client + v2s32(50, 10);
Environment->addStaticText(wgettext("Favorites:"), wchar_t* text = wgettext("Favorites:");
Environment->addStaticText(text,
rect, false, true, this, GUI_ID_SERVERLIST_TITLE); rect, false, true, this, GUI_ID_SERVERLIST_TITLE);
delete[] text;
} }
#endif #endif
updateGuiServerList(); updateGuiServerList();
@ -1372,9 +1378,11 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
readInput(&cur); readInput(&cur);
if (getTab() == TAB_MULTIPLAYER && cur.address == L"") if (getTab() == TAB_MULTIPLAYER && cur.address == L"")
{ {
wchar_t* text = wgettext("Address required.");
(new GUIMessageMenu(env, parent, -1, menumgr, (new GUIMessageMenu(env, parent, -1, menumgr,
wgettext("Address required.")) text)
)->drop(); )->drop();
delete[] text;
return true; return true;
} }
acceptInput(); acceptInput();