From 66daa1e23f6135e6f3067c61644ad3c1283fb6e2 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 23 Jan 2010 10:16:12 -0600 Subject: [PATCH] Don't allow process callback to be invoked between Engine and JACK::Client destruction. Patch submitted by Peter Nelson. Comments added. --- Timeline/Engine/Engine.C | 4 ++++ nonlib/JACK/Client.C | 8 +++++++- nonlib/JACK/Client.H | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Timeline/Engine/Engine.C b/Timeline/Engine/Engine.C index 00c49c6..323c734 100644 --- a/Timeline/Engine/Engine.C +++ b/Timeline/Engine/Engine.C @@ -38,6 +38,10 @@ Engine::Engine ( ) : _thread( "RT" ) Engine::~Engine ( ) { + /* We have to deactivate here in order to avoid our process + callback is being invoked after we're already destroyed, but + before the base class is */ + deactivate(); } diff --git a/nonlib/JACK/Client.C b/nonlib/JACK/Client.C index b9b41ae..08df27f 100644 --- a/nonlib/JACK/Client.C +++ b/nonlib/JACK/Client.C @@ -34,10 +34,16 @@ namespace JACK Client::~Client ( ) { - jack_deactivate( _client ); jack_client_close( _client ); } + /** Tell JACK to calling process callback. This MUST be called in + * an inheriting class' destructor */ + void + Client::deactivate ( ) + { + jack_deactivate( _client ); + } /*******************/ diff --git a/nonlib/JACK/Client.H b/nonlib/JACK/Client.H index 53ff47b..e3b0c60 100644 --- a/nonlib/JACK/Client.H +++ b/nonlib/JACK/Client.H @@ -55,6 +55,10 @@ namespace JACK Client ( const Client &rhs ); Client & operator = ( const Client &rhs ); + protected: + + void deactivate ( void ); + private: friend class Port;