Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10554


Ignore:
Timestamp:
Aug 29, 2015, 4:23:00 PM (9 years ago)
Author:
landauf
Message:

Gametype should store a WeakPtr to GametypeInfo to avoid circular reference if GametypeInfo references back to its Gametype

Location:
code/branches/core7/src/orxonox/gametypes
Files:
2 edited

Legend:

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

    r10479 r10554  
    6161        RegisterObject(Gametype);
    6262
     63        this->setGametype(SmartPtr<Gametype>(this, false));
     64
    6365        this->gtinfo_ = new GametypeInfo(context);
    64 
    65         this->setGametype(SmartPtr<Gametype>(this, false));
     66        this->gtinfo_->setGametype(this);
    6667
    6768        this->defaultControllableEntity_ = Class(Spectator);
     
    9899        if (this->isInitialized())
    99100        {
    100             this->gtinfo_->destroy();
     101            if (this->gtinfo_)
     102                this->gtinfo_->destroy();
    101103
    102104            ModifyConsoleCommand(__CC_addBots_name).setObject(NULL);
  • code/branches/core7/src/orxonox/gametypes/Gametype.h

    r10349 r10554  
    176176            virtual void importMementoState(const std::vector<GSLevelMementoState*>& states);
    177177
    178             SmartPtr<GametypeInfo> gtinfo_;
     178            WeakPtr<GametypeInfo> gtinfo_;
    179179
    180180            bool bAutoStart_;
Note: See TracChangeset for help on using the changeset viewer.