Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2008, 8:28:14 PM (15 years ago)
Author:
rgrieder
Message:

Completed destruction of static elements like XMLPort, Identifier, etc.
Of initially about 250 memory leaks (not in the actual meaning but the memory was never freed anyway) only 1 remains in TinyCpp.

  • Core class is now a normal Singleton that gets created and destroyed in main.
  • The same goes for Language, LuaBind, SignalHandler and PlayerManager.
  • Added a new std::set to the CommandExecutor so that the external ConsoleCommands can get destroyed too.
  • Code for destroying CommandLineArguments
  • Added destruction code for ConstructionCallbacks in Identifier
  • Moved internal identifier map (the one with the typeid(.) names) in a static function in Identifier. This was necessary in order to destroy ALL Identifiers with the static destruction function. Before it was possible to create an Identifier with having a class instance (that would call RegisterObject) for instance by simply accessing it via getIdentifier.
  • Removed a big memory leak in Button (forgot to destroy the ConfigValueContainers)
  • Added destruction code for InputBufferListenerTuples in InputBuffer destructor.
  • Added destruction code for load and save executors in both XMLPortParam and XMLPortObject
  • Added destruction code for ConsoleCommands in GSRoot, GSGraphics and GSLevel (temporary solution anyway)
  • Deleting the CEGUILua script module seems to work properly now, one memory leak less (GUIManager.cc)
  • Added global destruction calls in Main.cc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/gamestates/GSLevel.cc

    r2173 r2344  
    4747#include "CameraManager.h"
    4848#include "LevelManager.h"
     49#include "PlayerManager.h"
    4950#include "Settings.h"
    5051
     
    99100            // create the global LevelManager
    100101            this->levelManager_ = new LevelManager();
     102            this->playerManager_ = new PlayerManager();
    101103
    102104            // reset game speed to normal
     
    114116            FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
    115117            functor1->setObject(this);
    116             CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "keybind"));
     118            ccKeybind_ = createConsoleCommand(functor1, "keybind");
     119            CommandExecutor::addConsoleCommandShortcut(ccKeybind_);
    117120            FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind);
    118121            functor2->setObject(this);
    119             CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "tkeybind"));
     122            ccTkeybind_ = createConsoleCommand(functor2, "tkeybind");
     123            CommandExecutor::addConsoleCommandShortcut(ccTkeybind_);
    120124            // set our console command as callback for the key detector
    121125            InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_);
     
    130134            FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor);
    131135            functor->setObject(this);
    132             CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
     136            ccSetTimeFactor_ = createConsoleCommand(functor, "setTimeFactor");
     137            CommandExecutor::addConsoleCommandShortcut(ccSetTimeFactor_).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);;
    133138        }
    134139    }
     
    136141    void GSLevel::leave()
    137142    {
     143        // destroy console commands
     144        delete this->ccKeybind_;
     145        delete this->ccSetTimeFactor_;
     146        delete this->ccTkeybind_;
     147
    138148        // this call will delete every BaseObject!
    139149        // But currently this will call methods of objects that exist no more
     
    156166        if (this->levelManager_)
    157167            delete this->levelManager_;
     168
     169        if (this->playerManager_)
     170            delete this->playerManager_;
    158171
    159172        if (Core::showsGraphics())
Note: See TracChangeset for help on using the changeset viewer.