Index: Source/platform/LifecycleNotifier.h |
diff --git a/Source/platform/LifecycleNotifier.h b/Source/platform/LifecycleNotifier.h |
index 57d684f009aa4b463b3ac7e83c32ac36dabbf581..f75d3cfccf7017b07b36210fcc9ca59186228864 100644 |
--- a/Source/platform/LifecycleNotifier.h |
+++ b/Source/platform/LifecycleNotifier.h |
@@ -64,6 +64,8 @@ protected: |
{ |
} |
+ virtual void removeAndNotifyAllObservers(); |
+ |
Context* context() const { return m_context; } |
enum IterationType { |
@@ -86,7 +88,7 @@ private: |
}; |
template<typename T> |
-inline LifecycleNotifier<T>::~LifecycleNotifier() |
+inline void LifecycleNotifier<T>::removeAndNotifyAllObservers() |
{ |
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverAll); |
for (typename ObserverSet::iterator it = m_observers.begin(); it != m_observers.end(); it = m_observers.begin()) { |
@@ -98,6 +100,12 @@ inline LifecycleNotifier<T>::~LifecycleNotifier() |
} |
template<typename T> |
+inline LifecycleNotifier<T>::~LifecycleNotifier() |
+{ |
+ removeAndNotifyAllObservers(); |
+} |
+ |
+template<typename T> |
inline void LifecycleNotifier<T>::addObserver(typename LifecycleNotifier<T>::Observer* observer) |
{ |
RELEASE_ASSERT(m_iterating != IteratingOverAll); |