Fixed bug 1425890. Last SmartPtr in linked chain NULLs its prev & next
pointers to prevent infinite recursion. Added asserts. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@527 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
9412bbe3a3
commit
261f5f3cc0
1 changed files with 18 additions and 3 deletions
|
@ -387,15 +387,26 @@ namespace Loki
|
||||||
|
|
||||||
bool Release()
|
bool Release()
|
||||||
{
|
{
|
||||||
if (next_ == this)
|
if ( NULL == next_ )
|
||||||
|
{
|
||||||
|
assert( NULL == prev_ );
|
||||||
|
// Return false so it does not try to destroy shared object
|
||||||
|
// more than once.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (next_ == this)
|
||||||
{
|
{
|
||||||
assert(prev_ == this);
|
assert(prev_ == this);
|
||||||
|
// Set these to NULL to prevent re-entrancy.
|
||||||
|
prev_ = NULL;
|
||||||
|
next_ = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
assert( this != prev_ );
|
||||||
|
assert( NULL != prev_ );
|
||||||
prev_->next_ = next_;
|
prev_->next_ = next_;
|
||||||
next_->prev_ = prev_;
|
next_->prev_ = prev_;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Swap(RefLinkedBase& rhs)
|
void Swap(RefLinkedBase& rhs)
|
||||||
|
@ -1438,6 +1449,10 @@ namespace std
|
||||||
#endif // SMARTPTR_INC_
|
#endif // SMARTPTR_INC_
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.15 2006/02/08 18:12:29 rich_sposato
|
||||||
|
// Fixed bug 1425890. Last SmartPtr in linked chain NULLs its prev & next
|
||||||
|
// pointers to prevent infinite recursion. Added asserts.
|
||||||
|
//
|
||||||
// Revision 1.14 2006/01/30 20:07:38 syntheticpp
|
// Revision 1.14 2006/01/30 20:07:38 syntheticpp
|
||||||
// replace tabss
|
// replace tabss
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue