Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10579


Ignore:
Timestamp:
Sep 9, 2015, 4:14:14 PM (5 years ago)
Author:
landauf
Message:

inverted dependency between level and gametype: gametype now references level with a strong-pointer, but level references gametype with a weak-pointer. this means that gametype can be destroyed before level which in turn means that level is the last instance that is destroyed when the level is unloaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/orxonox/Level.cc

    r10578 r10579  
    123123        Gametype* rootgametype = orxonox_cast<Gametype*>(identifier->fabricate(this));
    124124
    125         rootgametype->setLevel(StrongPtr<Level>(NULL)); // avoid circular references
    126         this->setGametype(StrongPtr<Gametype>(rootgametype));
     125        // store a weak-pointer to the gametype to avoid a circular dependency between this level and the gametype (which has a strong-reference on this level)
     126        this->setGametype(WeakPtr<Gametype>(rootgametype));
     127
    127128        rootgametype->init(); // call init() AFTER the gametype was set
    128129
Note: See TracChangeset for help on using the changeset viewer.