Changeset 1030 for branches/Carsten_PtrWork2/Source/System/FieldContainer/Base/OSGFieldContainer.inl
- Timestamp:
- 12/03/07 15:48:13 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Carsten_PtrWork2/Source/System/FieldContainer/Base/OSGFieldContainer.inl
r1017 r1030 104 104 FieldContainer::subReference(void) 105 105 { 106 FINFO(("FieldContainer::subReference [%p] START\n", this)); 107 106 108 --_internalRefCount; 107 109 108 if((_internalRefCount <= 0) && 109 (_weakRefCount <= 0) && 110 (_pAspectStore->getExternalRefCount() <= 0) ) 111 { 112 // empty pointer fields, destroy aspect 113 this->resolveLinks (); 114 this->destroyAspect(); 115 } 116 else if((_internalRefCount <= 0) && 117 (_pAspectStore->getExternalRefCount() <= 0) ) 118 { 119 // empty pointer fields 110 if((this ->_resolveInProgress == false) && 111 (this ->_internalRefCount <= 0 ) && 112 (_pAspectStore->getExternalRefCount() <= 0 ) ) 113 { 114 FINFO(("FieldContainer::subReference [%p] E, I - RESOLVE\n", this)); 115 116 this->_resolveInProgress = true; 120 117 this->resolveLinks(); 121 } 118 119 if(this->_weakRefCount <= 0) 120 { 121 FINFO(("FieldContainer::subReference [%p] E, I, W - RESOLVE, DESTROY\n", this)); 122 123 this->destroyAspect(); 124 } 125 else 126 { 127 this->_resolveInProgress = false; 128 } 129 } 130 131 FINFO(("FieldContainer::subReference [%p] STOP\n", this)); 122 132 } 123 133 … … 164 174 FieldContainer::subExternalReference(void) 165 175 { 176 FINFO(("FieldContainer::subExternalReference [%p] START\n", this)); 177 166 178 _pAspectStore->acquireExternalReferenceCountLock(); 167 179 … … 170 182 if(_pAspectStore->getExternalRefCount() <= 0) 171 183 { 184 FINFO(("FieldContainer::subExternalReference [%p] E\n", this)); 185 172 186 _pAspectStore->releaseExternalReferenceCountLock(); 173 187 … … 178 192 FieldContainerPtr pAspect = _pAspectStore->getPtr(i); 179 193 180 if((pAspect != NullFC) &&181 (pAspect-> getRefCount() <= 0) &&182 (pAspect-> getWeakRefCount()<= 0 ) )194 if((pAspect != NullFC) && 195 (pAspect->_resolveInProgress == false ) && 196 (pAspect->_internalRefCount <= 0 ) ) 183 197 { 184 // empty fields, destroy aspect 185 pAspect->resolveLinks ( ); 186 lastAspect = pAspect->destroyAspect(pAspect->getId(), i); 198 FINFO(("FieldContainer::subExternalReference [%p] E, I - RESOLVE\n", pAspect)); 199 200 pAspect->_resolveInProgress = true; 201 pAspect->resolveLinks(); 187 202 188 if(lastAspect == true) 189 break; 203 if(pAspect->_weakRefCount <= 0) 204 { 205 FINFO(("FieldContainer::subExternalReference [%p] E, I, W - RESOLVE, DESTROY\n", pAspect)); 206 207 lastAspect = pAspect->destroyAspect(pAspect->getId(), i); 208 } 209 else 210 { 211 pAspect->_resolveInProgress = false; 212 } 190 213 } 191 else if((pAspect != NullFC) && 192 (pAspect->getRefCount() <= 0 ) ) 193 { 194 pAspect->resolveLinks(); // empty pointer fields 195 } 214 215 if(lastAspect == true) 216 break; 196 217 } 197 218 } … … 200 221 _pAspectStore->releaseExternalReferenceCountLock(); 201 222 } 223 224 FINFO(("FieldContainer::subExternalReference [%p] STOP\n", this)); 202 225 } 203 226 … … 228 251 FieldContainer::subWeakReference(void) 229 252 { 253 FINFO(("FieldContainer::subWeakReference [%p] START\n", this)); 254 230 255 --_weakRefCount; 231 256 232 if((_internalRefCount <= 0) && 233 (_weakRefCount <= 0) && 234 (_pAspectStore->getExternalRefCount() <= 0) ) 235 { 236 this->resolveLinks (); // empty pointer fields 257 if((this ->_resolveInProgress == false) && 258 (this ->_internalRefCount <= 0 ) && 259 (this ->_weakRefCount <= 0 ) && 260 (_pAspectStore->getExternalRefCount() <= 0 ) ) 261 { 262 FINFO(("FieldContainer::subWeakReference [%p] E, I, W - DESTROY\n", this)); 263 237 264 this->destroyAspect(); 238 265 } 266 267 FINFO(("FieldContainer::subWeakReference [%p] STOP\n", this)); 239 268 } 240 269 … … 250 279 inline 251 280 FieldContainer::FieldContainer(void) : 252 Inherited ( ), 253 #ifdef OSG_MT_CPTR_ASPECT 254 _pAspectStore (NULL), 255 #endif 256 _pFieldFlags (NULL), 257 _mfChangedFunctors( ), 258 _internalRefCount ( 0), 259 _weakRefCount ( 0) 281 Inherited ( ), 282 #ifdef OSG_MT_CPTR_ASPECT 283 _pAspectStore (NULL ), 284 #endif 285 _pFieldFlags (NULL ), 286 _mfChangedFunctors( ), 287 _internalRefCount ( 0), 288 _weakRefCount ( 0), 289 _resolveInProgress(false), 290 _destroyInProgress(false) 260 291 { 261 292 _pFieldFlags = new FieldFlags; … … 271 302 _mfChangedFunctors(source._mfChangedFunctors), 272 303 _internalRefCount ( 0), 273 _weakRefCount ( 0) 304 _weakRefCount ( 0), 305 _resolveInProgress(false ), 306 _destroyInProgress(false ) 274 307 { 275 308 _pFieldFlags = new FieldFlags(*(source._pFieldFlags));
