WAGE: Stop leaking menu on exit

This commit is contained in:
Eugene Sandulenko 2016-01-11 19:55:37 +01:00
parent 061a00bf09
commit db503e967d
2 changed files with 11 additions and 0 deletions

View File

@ -62,6 +62,7 @@ struct MenuSubItem {
int style;
char shortcut;
bool enabled;
Common::Rect bbox;
MenuSubItem(const char *t, int a, int s = 0, char sh = 0, bool e = true) : text(t), action(a), style(s), shortcut(sh), enabled(e) {}
};
@ -69,6 +70,7 @@ struct MenuSubItem {
struct MenuItem {
Common::String name;
Common::Array<MenuSubItem *> subitems;
Common::Rect bbox;
MenuItem(const char *n) : name(n) {}
};
@ -145,6 +147,14 @@ Menu::Menu(Gui *gui) : _gui(gui) {
}
}
Menu::~Menu() {
for (int i = 0; i < _items.size(); i++) {
for (int j = 0; j < _items[i]->subitems.size(); j++)
delete _items[i]->subitems[j];
delete _items[i];
}
}
const Graphics::Font *Menu::getMenuFont() {
return _gui->getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
}

View File

@ -55,6 +55,7 @@ struct MenuItem;
class Menu {
public:
Menu(Gui *gui);
~Menu();
void render();