Skip to content

Commit

Permalink
Fix small memory leaks on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and sapier committed Jun 20, 2014
1 parent ef8cdd8 commit e81454f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/guiEngine.cpp
Expand Up @@ -205,8 +205,9 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
}

m_menu->quitMenu();
m_menu->drop();
m_menu = 0;
m_menu->remove();
delete m_menu;
m_menu = NULL;
}

/******************************************************************************/
Expand Down Expand Up @@ -279,8 +280,6 @@ GUIEngine::~GUIEngine()
m_sound_manager = NULL;
}

//TODO: clean up m_menu here

infostream<<"GUIEngine: Deinitializing scripting"<<std::endl;
delete m_script;

Expand Down
5 changes: 5 additions & 0 deletions src/guiFormSpecMenu.cpp
Expand Up @@ -102,6 +102,11 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
GUIFormSpecMenu::~GUIFormSpecMenu()
{
removeChildren();

for (u32 i = 0; i < m_tables.size(); ++i) {
GUITable *table = m_tables[i].second;
table->drop();
}

delete m_selected_item;

Expand Down
2 changes: 2 additions & 0 deletions src/guiTable.cpp
Expand Up @@ -98,6 +98,8 @@ GUITable::~GUITable()

if (m_font)
m_font->drop();

m_scrollbar->remove();
}

GUITable::Option GUITable::splitOption(const std::string &str)
Expand Down

0 comments on commit e81454f

Please sign in to comment.