ensure that Dispose is invoked at one point.

This commit is contained in:
Mathieu Lacage
2008-03-02 06:32:03 +01:00
parent a5e8bdf451
commit ed22af820c

View File

@@ -1319,10 +1319,22 @@ Object::MaybeDelete (void) const
current = current->m_next;
} while (current != this);
// Ensure we are disposed.
Object *tmp = const_cast<Object *> (this);
const Object *end = this;
do {
NS_ASSERT (current != 0);
Object *next = tmp->m_next;
if (!tmp->m_disposed)
{
tmp->DoDispose ();
}
tmp = next;
} while (tmp != end);
// all attached objects have a zero count so,
// we can delete all attached objects.
current = this;
const Object *end = this;
do {
NS_ASSERT (current != 0);
Object *next = current->m_next;