diff --git a/Timeline/Sequence.C b/Timeline/Sequence.C index 2636554..8c7c082 100644 --- a/Timeline/Sequence.C +++ b/Timeline/Sequence.C @@ -78,6 +78,9 @@ Sequence::~Sequence ( ) if ( _widgets.size() ) FATAL( "programming error: leaf destructor must call Sequence::clear()!" ); + + if ( parent() ) + parent()->remove( this ); } diff --git a/Timeline/Track.C b/Timeline/Track.C index 662d3a9..b2f334f 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -490,7 +490,18 @@ Track::remove ( Audio_Sequence *t ) timeline->wrlock(); - takes->remove( t ); + if ( sequence() == t ) + { + pack->remove( t ); + + if ( takes->children() ) + sequence( (Audio_Sequence*)takes->child( 0 ) ); + else + /* FIXME: should this ever happen? */ + _sequence = NULL; + } + else + takes->remove( t ); /* delete t; */