Destroy sequence contents in sequence destructor.

Destroy loggables in correct order.
This commit is contained in:
Jonathan Moore Liles 2008-05-06 21:00:36 -05:00
parent 1318ba3c3a
commit 42e0e380bd
2 changed files with 24 additions and 5 deletions

View File

@ -84,16 +84,19 @@ Loggable::close ( void )
_fp = NULL; _fp = NULL;
for ( int i = _log_id; i--; ) for ( int i = 0; i < _log_id - 1; ++i )
{ {
Loggable ** l = &_loggables[ i ]; Loggable ** l = &_loggables[ i ];
if ( *l ) if ( *l )
{
delete *l; delete *l;
*l = NULL;
*l = NULL; }
} }
_log_id = 0;
return true; return true;
} }
@ -719,10 +722,13 @@ Loggable::log_create ( void ) const
void void
Loggable::log_destroy ( void ) const Loggable::log_destroy ( void ) const
{ {
// indent(); if ( ! _fp )
/* tearing down... don't bother */
return;
log( "%s 0x%X destroy (nothing) << ", class_name(), _id ); log( "%s 0x%X destroy (nothing) << ", class_name(), _id );
char **sa; char **sa;
Log_Entry e; Log_Entry e;

View File

@ -59,6 +59,19 @@ Sequence::init ( void )
Sequence::~Sequence ( ) Sequence::~Sequence ( )
{ {
/* FIXME: what to do with regions? */ /* FIXME: what to do with regions? */
for ( std::list <Sequence_Widget*>::iterator i = _widgets.begin();
i != _widgets.end(); ++i )
{
Sequence_Widget *w = *i;
*i = NULL;
delete w;
}
_widgets.clear();
parent()->redraw(); parent()->redraw();
parent()->remove( this ); parent()->remove( this );
// log_destroy(); // log_destroy();