Changeset 7850 for code/trunk
- Timestamp:
- Feb 10, 2011, 10:26:46 PM (14 years ago)
- Location:
- code/trunk/src/libraries/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/OrxonoxClass.h
r7849 r7850 195 195 protected: 196 196 inline void registerAsDestructionListener(OrxonoxClass* object) 197 { object->registerDestructionListener(this);}197 { if (object) { object->registerDestructionListener(this); } } 198 198 inline void unregisterAsDestructionListener(OrxonoxClass* object) 199 { object->unregisterDestructionListener(this);}199 { if (object) { object->unregisterDestructionListener(this); } } 200 200 201 201 virtual void objectDeleted() = 0; -
code/trunk/src/libraries/core/WeakPtr.h
r7849 r7850 112 112 inline WeakPtr(T* pointer) : pointer_(pointer), base_(pointer), callback_(0) 113 113 { 114 if (this->base_) 115 this->registerAsDestructionListener(this->base_); 114 this->registerAsDestructionListener(this->base_); 116 115 } 117 116 … … 119 118 inline WeakPtr(const WeakPtr& other) : pointer_(other.pointer_), base_(other.base_), callback_(0) 120 119 { 121 if (this->base_) 122 this->registerAsDestructionListener(this->base_); 120 this->registerAsDestructionListener(this->base_); 123 121 } 124 122 … … 127 125 inline WeakPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.base_), callback_(0) 128 126 { 129 if (this->base_) 130 this->registerAsDestructionListener(this->base_); 127 this->registerAsDestructionListener(this->base_); 131 128 } 132 129 … … 134 131 inline ~WeakPtr() 135 132 { 136 if (this->base_) 137 this->unregisterAsDestructionListener(this->base_); 138 133 this->unregisterAsDestructionListener(this->base_); 139 134 } 140 135 … … 209 204 inline void swap(WeakPtr& other) 210 205 { 211 if (this->base_) 212 this->unregisterAsDestructionListener(this->base_); 213 if (other.base_) 214 other.unregisterAsDestructionListener(other.base_); 206 this->unregisterAsDestructionListener(this->base_); 207 other.unregisterAsDestructionListener(other.base_); 215 208 216 209 { … … 225 218 } 226 219 227 if (this->base_) 228 this->registerAsDestructionListener(this->base_); 229 if (other.base_) 230 other.registerAsDestructionListener(other.base_); 220 this->registerAsDestructionListener(this->base_); 221 other.registerAsDestructionListener(other.base_); 231 222 } 232 223
Note: See TracChangeset
for help on using the changeset viewer.