From ca530216eca456848dafa32aca65c226fb283a73 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 25 May 2007 12:27:40 +0200 Subject: [PATCH] add a m_disposed field and check it --- src/core/object.cc | 7 ++++++- src/core/object.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/object.cc b/src/core/object.cc index 0d5157ffc..f9b9f379e 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -107,6 +107,7 @@ const InterfaceId Object::iid = MakeObjectInterfaceId (); Object::Object () : m_count (1), m_iid (Object::iid), + m_disposed (false), m_next (this) {} Object::~Object () @@ -139,7 +140,9 @@ Object::Dispose (void) Object *current = this; do { NS_ASSERT (current != 0); + NS_ASSERT (!current->m_disposed); current->DoDispose (); + current->m_disposed = true; current = current->m_next; } while (current != this); } @@ -166,7 +169,9 @@ Object::SetInterfaceId (InterfaceId iid) void Object::DoDispose (void) -{} +{ + NS_ASSERT (!m_disposed); +} bool Object::Check (void) const diff --git a/src/core/object.h b/src/core/object.h index be90b8963..330d1d61b 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -67,6 +67,7 @@ private: void MaybeDelete (void) const; mutable uint32_t m_count; InterfaceId m_iid; + bool m_disposed; Object *m_next; };