Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix gettext memory leaks
  • Loading branch information
sapier authored and PilzAdam committed May 10, 2013
1 parent ee1155f commit d859ad7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/guiMainMenu.cpp
Expand Up @@ -483,25 +483,31 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
{
core::rect<s32> rect(0, 0, 390, 20);
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);
delete[] text;
}
} else {
m_data->servers = ServerList::getOnline();
{
core::rect<s32> rect(0, 0, 390, 20);
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);
delete[] text;
}
}
#else
m_data->servers = ServerList::getLocal();
{
core::rect<s32> rect(0, 0, 390, 20);
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);
delete[] text;
}
#endif
updateGuiServerList();
Expand Down Expand Up @@ -1372,9 +1378,11 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
readInput(&cur);
if (getTab() == TAB_MULTIPLAYER && cur.address == L"")
{
wchar_t* text = wgettext("Address required.");
(new GUIMessageMenu(env, parent, -1, menumgr,
wgettext("Address required."))
text)
)->drop();
delete[] text;
return true;
}
acceptInput();
Expand Down

0 comments on commit d859ad7

Please sign in to comment.