Fix small memory leaks on shutdown
authorsapier <Sapier at GMX dot net>
Fri, 20 Jun 2014 17:50:47 +0000 (19:50 +0200)
committersapier <Sapier at GMX dot net>
Fri, 20 Jun 2014 17:50:47 +0000 (19:50 +0200)
src/guiEngine.cpp
src/guiFormSpecMenu.cpp
src/guiTable.cpp

index 671f0c574dbd91fd7ac31e65744a1bc1329f272d..34bdaffad23ee6e6e6a2723a9bf5a8c4c45b50fb 100644 (file)
@@ -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;
 }
 
 /******************************************************************************/
@@ -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;
 
index f69f1b9a5496a92dc0a91b1996d49ea5c48aacda..6073ed7ccb9fcc27a3211a1e7a88362092652bf1 100644 (file)
@@ -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;
 
index 5febb8370fd0a93aebe66bd19a09ce54cd4b442e..4d6fc195072add988769a3601c1cfa41512eee09 100644 (file)
@@ -98,6 +98,8 @@ GUITable::~GUITable()
 
        if (m_font)
                m_font->drop();
+       
+       m_scrollbar->remove();
 }
 
 GUITable::Option GUITable::splitOption(const std::string &str)