@@ -83,9 +83,9 @@ public: | |||||
~Annotation_Sequence ( ) | ~Annotation_Sequence ( ) | ||||
{ | { | ||||
track()->remove( this ); | |||||
log_destroy(); | log_destroy(); | ||||
track()->remove( this ); | |||||
} | } | ||||
int handle ( int m ) | int handle ( int m ) | ||||
@@ -49,9 +49,9 @@ Audio_Sequence::Audio_Sequence ( Track *track ) : Sequence( track ) | |||||
Audio_Sequence::~Audio_Sequence ( ) | Audio_Sequence::~Audio_Sequence ( ) | ||||
{ | { | ||||
track()->remove( this ); | |||||
log_destroy(); | log_destroy(); | ||||
track()->remove( this ); | |||||
} | } | ||||
@@ -65,8 +65,6 @@ Control_Sequence::~Control_Sequence ( ) | |||||
delete _output; | delete _output; | ||||
_output = NULL; | _output = NULL; | ||||
log_destroy(); | |||||
} | } | ||||
void | void | ||||
@@ -76,6 +76,8 @@ Disk_Stream::~Disk_Stream ( ) | |||||
shutdown(); | shutdown(); | ||||
/* FIXME: we must wait on the thread to finish here!!! */ | |||||
_track = NULL; | _track = NULL; | ||||
sem_destroy( &_blocks ); | sem_destroy( &_blocks ); | ||||
@@ -136,12 +138,6 @@ Disk_Stream::shutdown ( void ) | |||||
if ( _thread ) | if ( _thread ) | ||||
pthread_detach( _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; | _thread = 0; | ||||
} | } | ||||
@@ -196,8 +196,6 @@ Playback_DS::disk_thread ( void ) | |||||
#ifndef AVOID_UNNECESSARY_COPYING | #ifndef AVOID_UNNECESSARY_COPYING | ||||
delete[] cbuf; | delete[] cbuf; | ||||
#endif | #endif | ||||
_terminate = false; | |||||
} | } | ||||
/* THREAD: RT */ | /* THREAD: RT */ | ||||
@@ -63,6 +63,9 @@ Sequence::init ( void ) | |||||
Sequence::~Sequence ( ) | Sequence::~Sequence ( ) | ||||
{ | { | ||||
DMESSAGE( "destroying sequence" ); | |||||
if ( _name ) | if ( _name ) | ||||
free( _name ); | free( _name ); | ||||
@@ -247,6 +247,8 @@ Track::Track ( const char *L, int channels ) : | |||||
Track::~Track ( ) | Track::~Track ( ) | ||||
{ | { | ||||
log_destroy(); | |||||
timeline->remove_track( this ); | timeline->remove_track( this ); | ||||
/* give up our ports */ | /* give up our ports */ | ||||
@@ -260,8 +262,10 @@ Track::~Track ( ) | |||||
delete control_out.back(); | delete control_out.back(); | ||||
control_out.pop_back(); | control_out.pop_back(); | ||||
} | } | ||||
log_destroy(); | |||||
_sequence = NULL; | |||||
takes = NULL; | |||||
control = NULL; | |||||
annotation = NULL; | |||||
if ( _name ) | if ( _name ) | ||||
free( _name ); | free( _name ); | ||||
@@ -355,6 +359,9 @@ Track::add ( Audio_Sequence * t ) | |||||
void | void | ||||
Track::remove ( Audio_Sequence *t ) | Track::remove ( Audio_Sequence *t ) | ||||
{ | { | ||||
if ( ! takes ) | |||||
return; | |||||
timeline->wrlock(); | timeline->wrlock(); | ||||
takes->remove( t ); | takes->remove( t ); | ||||
@@ -369,6 +376,9 @@ Track::remove ( Audio_Sequence *t ) | |||||
void | void | ||||
Track::remove ( Annotation_Sequence *t ) | Track::remove ( Annotation_Sequence *t ) | ||||
{ | { | ||||
if ( ! annotation ) | |||||
return; | |||||
annotation->remove( t ); | annotation->remove( t ); | ||||
resize(); | resize(); | ||||
@@ -377,6 +387,9 @@ Track::remove ( Annotation_Sequence *t ) | |||||
void | void | ||||
Track::remove ( Control_Sequence *t ) | Track::remove ( Control_Sequence *t ) | ||||
{ | { | ||||
if ( ! control ) | |||||
return; | |||||
engine->lock(); | engine->lock(); | ||||
control->remove( t ); | control->remove( t ); | ||||