Fix order of track destruction.

pull/3/head
Jonathan Moore Liles 2008-05-27 19:36:17 -05:00
parent c8eb82d124
commit 455dc11dc8
7 changed files with 24 additions and 16 deletions

View File

@ -83,9 +83,9 @@ public:
~Annotation_Sequence ( )
{
track()->remove( this );
log_destroy();
track()->remove( this );
}
int handle ( int m )

View File

@ -49,9 +49,9 @@ Audio_Sequence::Audio_Sequence ( Track *track ) : Sequence( track )
Audio_Sequence::~Audio_Sequence ( )
{
track()->remove( this );
log_destroy();
track()->remove( this );
}

View File

@ -65,8 +65,6 @@ Control_Sequence::~Control_Sequence ( )
delete _output;
_output = NULL;
log_destroy();
}
void

View File

@ -76,6 +76,8 @@ Disk_Stream::~Disk_Stream ( )
shutdown();
/* FIXME: we must wait on the thread to finish here!!! */
_track = NULL;
sem_destroy( &_blocks );
@ -136,12 +138,6 @@ Disk_Stream::shutdown ( void )
if ( _thread )
pthread_detach( _thread );
/* we must block until the thread returns, because it might
* still have data left to process in its buffers--and we
* don't want to delete any of the datastructures it's using
* until it finishes with them. */
// pthread_join( _thread, NULL );
_thread = 0;
}

View File

@ -196,8 +196,6 @@ Playback_DS::disk_thread ( void )
#ifndef AVOID_UNNECESSARY_COPYING
delete[] cbuf;
#endif
_terminate = false;
}
/* THREAD: RT */

View File

@ -63,6 +63,9 @@ Sequence::init ( void )
Sequence::~Sequence ( )
{
DMESSAGE( "destroying sequence" );
if ( _name )
free( _name );

View File

@ -247,6 +247,8 @@ Track::Track ( const char *L, int channels ) :
Track::~Track ( )
{
log_destroy();
timeline->remove_track( this );
/* give up our ports */
@ -260,8 +262,10 @@ Track::~Track ( )
delete control_out.back();
control_out.pop_back();
}
log_destroy();
_sequence = NULL;
takes = NULL;
control = NULL;
annotation = NULL;
if ( _name )
free( _name );
@ -355,6 +359,9 @@ Track::add ( Audio_Sequence * t )
void
Track::remove ( Audio_Sequence *t )
{
if ( ! takes )
return;
timeline->wrlock();
takes->remove( t );
@ -369,6 +376,9 @@ Track::remove ( Audio_Sequence *t )
void
Track::remove ( Annotation_Sequence *t )
{
if ( ! annotation )
return;
annotation->remove( t );
resize();
@ -377,6 +387,9 @@ Track::remove ( Annotation_Sequence *t )
void
Track::remove ( Control_Sequence *t )
{
if ( ! control )
return;
engine->lock();
control->remove( t );