Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10543 for code/branches/core7


Ignore:
Timestamp:
Jun 7, 2015, 2:50:04 PM (9 years ago)
Author:
landauf
Message:

create and destroy root-context in a controlled manner

Location:
code/branches/core7/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/Core.cc

    r10542 r10543  
    123123        this->dynLibManager_ = new DynLibManager();
    124124
    125         // TODO: initialize Root-Context
     125        // create handler for static initialization
    126126        new StaticInitializationManager(); // create singleton
    127127        this->staticInitHandler_ = new CoreStaticInitializationHandler();
    128128        StaticInitializationManager::getInstance().addHandler(this->staticInitHandler_);
    129129
     130        // load root module (all libraries which are linked to the executable, including core, network, and orxonox)
    130131        this->rootModule_ = ModuleInstance::getCurrentModuleInstance();
    131132        StaticInitializationManager::getInstance().loadModule(this->rootModule_);
     
    170171        orxout(internal_info) << "Loading language:" << endl;
    171172        this->languageInstance_ = new Language();
     173
     174        // initialize root context
     175        Context::setRootContext(new Context(NULL));
    172176
    173177        // Do this soon after the ConfigFileManager has been created to open up the
     
    251255        if (this->staticInitHandler_)
    252256            StaticInitializationManager::getInstance().removeHandler(this->staticInitHandler_);
     257        delete Context::getRootContext();
    253258        Context::setRootContext(NULL);
    254259        safeObjectDelete(&rootModule_);
  • code/branches/core7/src/libraries/core/object/Context.cc

    r10539 r10543  
    7676    /*static*/ void Context::setRootContext(Context* context)
    7777    {
    78         if (Context::rootContext_s)
    79             delete Context::rootContext_s;
    8078        Context::rootContext_s = context;
    8179    }
     
    8381    /*static*/ Context* Context::getRootContext()
    8482    {
    85         if (!Context::rootContext_s)
    86             Context::rootContext_s = new Context(NULL);
     83        OrxVerify(Context::rootContext_s != NULL, "Root Context is undefined");
    8784        return Context::rootContext_s;
    8885    }
Note: See TracChangeset for help on using the changeset viewer.