Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 2, 2015, 11:18:45 PM (10 years ago)
Author:
landauf
Message:

fixed potential crash during level-unloading: Namespace is a context and is thus potentially used by other objects → store a smartPtr on the namespace object

Location:
code/trunk/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/BaseObject.h

    r9667 r10298  
    138138                { return this->templates_; }
    139139
    140             virtual inline void setNamespace(Namespace* ns) { this->namespace_ = ns; }
    141             inline Namespace* getNamespace() const { return this->namespace_; }
     140            inline void setNamespace(const SmartPtr<Namespace>& ns) { this->namespace_ = ns; }
     141            inline const SmartPtr<Namespace>& getNamespace() const { return this->namespace_; }
    142142
    143143            inline void setCreator(BaseObject* creator) { this->creator_ = creator; }
     
    222222            std::map<std::string, std::string> xmlAttributes_; //!< Lowercase XML attributes
    223223            std::string            loaderIndentation_;         //!< Indentation of the debug output in the Loader
    224             Namespace*             namespace_;
     224            SmartPtr<Namespace>    namespace_;
    225225            BaseObject*            creator_;
    226226            SmartPtr<Scene>        scene_;
  • code/trunk/src/libraries/core/Namespace.cc

    r9667 r10298  
    4646    {
    4747        RegisterObject(Namespace);
     48
     49        this->setNamespace(SmartPtr<Namespace>(this, false));
    4850    }
    4951
Note: See TracChangeset for help on using the changeset viewer.