Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 24, 2013, 8:51:37 PM (11 years ago)
Author:
landauf
Message:

moved functions and attributes needed to safely destroy objects from OrxonoxClass to Destroyable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/class/OrxonoxClass.cc

    r9565 r9570  
    3535
    3636#include <cassert>
    37 #include "core/object/MetaObjectList.h"
    38 #include "core/object/Context.h"
    39 #include "Identifier.h"
    4037
    4138namespace orxonox
     
    4643    OrxonoxClass::OrxonoxClass()
    4744    {
    48         this->referenceCount_ = 0;
    49         this->requestedDestruction_ = false;
    5045    }
    5146
     
    5550    OrxonoxClass::~OrxonoxClass()
    5651    {
    57         assert(this->referenceCount_ <= 0);
    58 
    59         // notify all destruction listeners
    60         for (std::set<DestructionListener*>::iterator it = this->destructionListeners_.begin(); it != this->destructionListeners_.end(); )
    61             (*(it++))->objectDeleted();
    62     }
    63 
    64     /**
    65         @brief Deletes the object if no @ref orxonox::SmartPtr "smart pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
    66     */
    67     void OrxonoxClass::destroy()
    68     {
    69         assert(this); // Just in case someone tries to delete a NULL pointer
    70         this->requestedDestruction_ = true;
    71         if (this->referenceCount_ == 0)
    72         {
    73             this->preDestroy();
    74             if (this->referenceCount_ == 0)
    75                 delete this;
    76         }
    7752    }
    7853}
Note: See TracChangeset for help on using the changeset viewer.