mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-02-21 14:47:10 +01:00
Free views when popping them
This commit is contained in:
parent
32e422327c
commit
e50b1a1045
15
gui.cpp
15
gui.cpp
@ -128,11 +128,18 @@ void Gui::pushView(GuiView *view)
|
|||||||
|
|
||||||
GuiView *Gui::popView()
|
GuiView *Gui::popView()
|
||||||
{
|
{
|
||||||
|
GuiView *cur = this->peekView();
|
||||||
|
|
||||||
|
if (cur)
|
||||||
|
delete cur;
|
||||||
|
|
||||||
this->n_views--;
|
this->n_views--;
|
||||||
if (this->n_views <= 0)
|
if (this->n_views <= 0)
|
||||||
{
|
{
|
||||||
this->n_views = 0;
|
|
||||||
free(this->views);
|
free(this->views);
|
||||||
|
this->views = NULL;
|
||||||
|
this->n_views = 0;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,8 +151,10 @@ GuiView *Gui::popView()
|
|||||||
void Gui::exitMenu()
|
void Gui::exitMenu()
|
||||||
{
|
{
|
||||||
printf("Exiting the menu system\n");
|
printf("Exiting the menu system\n");
|
||||||
free(this->views);
|
|
||||||
this->views = NULL;
|
/* Pop all views */
|
||||||
|
while (this->popView())
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::pushEvent(SDL_Event *ev)
|
void Gui::pushEvent(SDL_Event *ev)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include "menu.hh"
|
||||||
|
|
||||||
class MainView;
|
class MainView;
|
||||||
class MainMenu : public Menu
|
class MainMenu : public Menu
|
||||||
{
|
{
|
||||||
@ -63,6 +65,11 @@ public:
|
|||||||
printf("entry %d selected: %s\n", which, this->pp_msgs[which]);
|
printf("entry %d selected: %s\n", which, this->pp_msgs[which]);
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
|
case 1:
|
||||||
|
if (this->p_submenus[0].sel == 0)
|
||||||
|
;
|
||||||
|
break;
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
this->dialogue = new ExitDialogue(this->font);
|
this->dialogue = new ExitDialogue(this->font);
|
||||||
this->dialogue->setSelectedBackground(NULL, NULL, NULL,
|
this->dialogue->setSelectedBackground(NULL, NULL, NULL,
|
||||||
@ -103,6 +110,12 @@ public:
|
|||||||
this->dialogue_bg = NULL;
|
this->dialogue_bg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~MainView()
|
||||||
|
{
|
||||||
|
delete this->help;
|
||||||
|
delete this->menu;
|
||||||
|
}
|
||||||
|
|
||||||
void updateTheme()
|
void updateTheme()
|
||||||
{
|
{
|
||||||
this->bg = parent->main_menu_bg;
|
this->bg = parent->main_menu_bg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user