Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2008, 8:28:14 PM (17 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/GSRoot.cc

    r2171 r2344  
    4040#include "core/TclBind.h"
    4141#include "core/TclThreadManager.h"
     42#include "core/LuaBind.h"
    4243#include "tools/Timer.h"
    4344#include "objects/Tickable.h"
     
    8788        // creates the class hierarchy for all classes with factories
    8889        Factory::createClassHierarchy();
     90
     91        // Create the lua interface
     92        this->luaBind_ = new LuaBind();
    8993
    9094        // instantiate Settings class
     
    117121        FunctorMember<GSRoot>* functor1 = createFunctor(&GSRoot::exitGame);
    118122        functor1->setObject(this);
    119         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "exit"));
     123        ccExit_ = createConsoleCommand(functor1, "exit");
     124        CommandExecutor::addConsoleCommandShortcut(ccExit_);
    120125
    121126        // add console commands
    122127        FunctorMember01<GameStateBase, const std::string&>* functor2 = createFunctor(&GameStateBase::requestState);
    123128        functor2->setObject(this);
    124         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "selectGameState"));
     129        ccSelectGameState_ = createConsoleCommand(functor2, "selectGameState");
     130        CommandExecutor::addConsoleCommandShortcut(ccSelectGameState_);
    125131    }
    126132
    127133    void GSRoot::leave()
    128134    {
    129         // TODO: remove and destroy console commands
     135        // destroy console commands
     136        delete this->ccExit_;
     137        delete this->ccSelectGameState_;
    130138
    131139        delete this->shell_;
     
    133141        delete this->tclBind_;
    134142
    135         delete settings_;
    136 
     143        delete this->settings_;
     144        delete this->luaBind_;
    137145    }
    138146
Note: See TracChangeset for help on using the changeset viewer.