Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 24, 2008, 10:40:22 PM (16 years ago)
Author:
rgrieder
Message:
  • privatised InputState c'tors
  • added destruction code for GUIManager
  • fixed some issues and bugs
  • found 2400 memory leaks ;)
  • haven't done anything about it
  • converted GUIManager to Ogre Singleton
  • added NULL checkers in Loader
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/gui/GUIManager.cc

    r1645 r1646  
    5858    SetConsoleCommandShortcut(GUIManager, showGUI_s).setKeybindMode(KeybindMode::OnPress);
    5959
     60    GUIManager* GUIManager::singletonRef_s = 0;
     61
    6062    GUIManager::GUIManager()
    6163        //: emptySceneManager_(0)
     
    7173        , state_(Uninitialised)
    7274    {
     75        assert(singletonRef_s == 0);
     76        singletonRef_s = this;
    7377    }
    7478
    7579    GUIManager::~GUIManager()
    7680    {
    77         // TODO: destruct at least something
     81        if (backgroundCamera_)
     82            backgroundSceneManager_->destroyCamera(backgroundCamera_);
     83
     84        if (backgroundSceneManager_)
     85            Ogre::Root::getSingleton().destroySceneManager(backgroundSceneManager_);
     86
     87        InputManager::getInstance().destroyState("gui");
     88
     89        if (guiSystem_)
     90            delete guiSystem_;
     91
     92        if (scriptModule_)
     93        {
     94            // destroy our own tolua interfaces
     95                //lua_pushnil(luaState_);
     96                //lua_setglobal(luaState_, "Orxonox");
     97                //lua_pushnil(luaState_);
     98                //lua_setglobal(luaState_, "Core");
     99            // TODO: deleting the script module fails an assertation.
     100            // However there is not much we can do about it since it occurs too when
     101            // we don't open Core or Orxonox. Might be a CEGUI issue.
     102            // The memory leak is not a problem anyway..
     103            //delete scriptModule_;
     104        }
     105
     106        if (guiRenderer_)
     107            delete guiRenderer_;
     108
     109        singletonRef_s = 0;
    78110    }
    79111
     
    104136                // setup scripting
    105137                this->scriptModule_ = new LuaScriptModule();
     138                this->luaState_ = this->scriptModule_->getLuaState();
    106139
    107140                // create the CEGUI system singleton
     
    267300
    268301
    269     /**
    270     @brief
    271         Returns a unique instance of GUIManager.
    272     @return
    273         The instance
    274     */
    275     GUIManager& GUIManager::getInstance()
    276     {
    277         static GUIManager instance;
    278         return instance;
    279     }
    280 
    281302    inline CEGUI::MouseButton GUIManager::convertButton(MouseButton::Enum button)
    282303    {
Note: See TracChangeset for help on using the changeset viewer.