Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 14, 2013, 6:42:28 PM (11 years ago)
Author:
landauf
Message:

added ability to set the root-context explicitly (and also to destroy it before the class-hierarchy is destroyed).
currently it's not possible to set the root context explicitly during startup of the game because it is already used by static initialization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/object/Context.cc

    r9629 r9649  
    3737namespace orxonox
    3838{
     39    Context* Context::rootContext_s = 0;
     40
    3941    Context::Context(Context* context) : Listable(this), parentContext_(context)
    4042    {
     
    5456    }
    5557
     58    /*static*/ void Context::setRootContext(Context* context)
     59    {
     60        if (Context::rootContext_s)
     61            delete Context::rootContext_s;
     62        Context::rootContext_s = context;
     63    }
     64
    5665    /*static*/ Context* Context::getRootContext()
    5766    {
    58         static Context rootContext(NULL);
    59         return &rootContext;
     67        if (!Context::rootContext_s)
     68            Context::rootContext_s = new Context(NULL);
     69        return Context::rootContext_s;
    6070    }
    6171
Note: See TracChangeset for help on using the changeset viewer.