mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Add context_destroyed to verifiables
Avoids destruction order fiasco as context can be destroyed before the functions/verifiables
This commit is contained in:
parent
72518b6297
commit
3b81a8e6c0
4 changed files with 16 additions and 0 deletions
|
|
@ -255,6 +255,11 @@ namespace detail
|
||||||
context_ = &c;
|
context_ = &c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void context_destroyed()
|
||||||
|
{
|
||||||
|
context_ = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
friend std::ostream& operator<<(
|
friend std::ostream& operator<<(
|
||||||
std::ostream& s, const function_impl& impl )
|
std::ostream& s, const function_impl& impl )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,13 @@ namespace detail
|
||||||
class group
|
class group
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~group()
|
||||||
|
{
|
||||||
|
for( verifiables_cit it = verifiables_.begin();
|
||||||
|
it != verifiables_.end(); ++it )
|
||||||
|
(*it)->context_destroyed();
|
||||||
|
}
|
||||||
|
|
||||||
void add( verifiable& v )
|
void add( verifiable& v )
|
||||||
{
|
{
|
||||||
verifiables_.push_back( &v );
|
verifiables_.push_back( &v );
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ namespace detail
|
||||||
if( children_.empty() )
|
if( children_.empty() )
|
||||||
detail::root::inst().remove( *this );
|
detail::root::inst().remove( *this );
|
||||||
}
|
}
|
||||||
|
virtual void context_destroyed()
|
||||||
|
{}
|
||||||
|
|
||||||
virtual void serialize( std::ostream& s, const verifiable& v ) const
|
virtual void serialize( std::ostream& s, const verifiable& v ) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ namespace detail
|
||||||
virtual bool verify() const = 0;
|
virtual bool verify() const = 0;
|
||||||
|
|
||||||
virtual void reset() = 0;
|
virtual void reset() = 0;
|
||||||
|
|
||||||
|
virtual void context_destroyed() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} // mock
|
} // mock
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue