diff --git a/include/turtle/detail/function_impl_template.hpp b/include/turtle/detail/function_impl_template.hpp index 4d47a82..8cc79af 100644 --- a/include/turtle/detail/function_impl_template.hpp +++ b/include/turtle/detail/function_impl_template.hpp @@ -255,6 +255,11 @@ namespace detail context_ = &c; } + virtual void context_destroyed() + { + context_ = NULL; + } + friend std::ostream& operator<<( std::ostream& s, const function_impl& impl ) { diff --git a/include/turtle/detail/group.hpp b/include/turtle/detail/group.hpp index d0668cc..7e0fc15 100644 --- a/include/turtle/detail/group.hpp +++ b/include/turtle/detail/group.hpp @@ -22,6 +22,13 @@ namespace detail class group { public: + ~group() + { + for( verifiables_cit it = verifiables_.begin(); + it != verifiables_.end(); ++it ) + (*it)->context_destroyed(); + } + void add( verifiable& v ) { verifiables_.push_back( &v ); diff --git a/include/turtle/detail/object_impl.hpp b/include/turtle/detail/object_impl.hpp index 5679b1c..5670825 100644 --- a/include/turtle/detail/object_impl.hpp +++ b/include/turtle/detail/object_impl.hpp @@ -56,6 +56,8 @@ namespace detail if( children_.empty() ) detail::root::inst().remove( *this ); } + virtual void context_destroyed() + {} virtual void serialize( std::ostream& s, const verifiable& v ) const { diff --git a/include/turtle/detail/verifiable.hpp b/include/turtle/detail/verifiable.hpp index 5d85c93..23203b5 100644 --- a/include/turtle/detail/verifiable.hpp +++ b/include/turtle/detail/verifiable.hpp @@ -25,6 +25,8 @@ namespace detail virtual bool verify() const = 0; virtual void reset() = 0; + + virtual void context_destroyed() = 0; }; } } // mock