Changeset 6412 for code/branches/pickup2/src/libraries/core/OrxonoxClass.cc
- Timestamp:
- Dec 25, 2009, 1:18:03 PM (16 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/libraries/core/OrxonoxClass.cc
r5929 r6412 34 34 #include "OrxonoxClass.h" 35 35 36 #include <cassert> 36 37 #include "MetaObjectList.h" 37 38 #include "Identifier.h" … … 48 49 this->referenceCount_ = 0; 49 50 this->requestedDestruction_ = false; 51 // Optimisation 52 this->objectPointers_.reserve(6); 50 53 } 51 54 … … 54 57 { 55 58 // if (!this->requestedDestruction_) 56 // COUT(2) << "Warning: Destroyed object without destroy() (" << this->getIdentifier()->getName() << ")"<< std::endl;59 // COUT(2) << "Warning: Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << std::endl; 57 60 58 61 assert(this->referenceCount_ <= 0); 59 62 60 delete this->metaList_;63 this->unregisterObject(); 61 64 62 65 // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class 63 66 if (this->parents_) 64 67 delete this->parents_; 65 68 66 69 // reset all weak pointers pointing to this object 67 70 for (std::set<WeakPtr<OrxonoxClass>*>::iterator it = this->weakPointers_.begin(); it != this->weakPointers_.end(); ) … … 72 75 void OrxonoxClass::destroy() 73 76 { 77 assert(this); // Just in case someone tries to delete a NULL pointer 74 78 this->requestedDestruction_ = true; 75 79 if (this->referenceCount_ == 0) 76 delete this; 80 { 81 this->preDestroy(); 82 if (this->referenceCount_ == 0) 83 delete this; 84 } 85 } 86 87 void OrxonoxClass::unregisterObject() 88 { 89 if (this->metaList_) 90 delete this->metaList_; 91 this->metaList_ = 0; 77 92 } 78 93
Note: See TracChangeset
for help on using the changeset viewer.