diff --git a/ChangeLog b/ChangeLog index c85397a6..23f6803d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,10 @@ Florian Faber Jackdmp changes log --------------------------- +2008-08-01 Stephane Letz + + * Fix desallocation of remaining clients when server quits. + 2008-07-25 Stephane Letz * Florian Faber patch for 32 bit float (LE only) support to jack's alsa driver. diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 447bf207..f443466e 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -78,13 +78,11 @@ int JackEngine::Close() // Close (possibly) remaining clients (RT is stopped) for (int i = 0; i < CLIENT_NUM; i++) { - /* - Can only delete clients that where loaded using "jack_internal_client_load" (and not properly unloaded using "jack_internal_client_unload"...) - */ - JackLoadableInternalClient* loadable_client = dynamic_cast(fClientTable[i]); - if (loadable_client) { - jack_log("JackEngine::Close delete loadable client %ld", i); - delete loadable_client; + JackClientInterface* client = fClientTable[i]; + if (client) { + jack_log("JackEngine::Close client = %s", client->GetClientControl()->fName); + client->Close(); + delete client; fClientTable[i] = NULL; } } diff --git a/common/JackRequest.h b/common/JackRequest.h index 7e4870ae..4c96323d 100644 --- a/common/JackRequest.h +++ b/common/JackRequest.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace Jack { -#define CheckRes(res) {if (res < 0) return res;} +#define CheckRes(exp) { if ((exp) < 0) return -1;} /*! \brief Request from client to server. diff --git a/common/JackSocket.cpp b/common/JackSocket.cpp index ceaddb81..db700f08 100644 --- a/common/JackSocket.cpp +++ b/common/JackSocket.cpp @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "JackError.h" #include #include +#include namespace Jack { @@ -120,9 +121,9 @@ int JackClientSocket::Connect(const char* dir, int which) int JackClientSocket::Close() { - jack_log("JackClientSocket::Close"); - //shutdown(fSocket, SHUT_RDWR); + jack_log("JackClientSocket::Close"); if (fSocket > 0) { + shutdown(fSocket, SHUT_RDWR); close(fSocket); fSocket = -1; return 0; @@ -272,10 +273,9 @@ JackClientSocket* JackServerSocket::Accept() int JackServerSocket::Close() { - //shutdown(fSocket, SHUT_RDWR); if (fSocket > 0) { jack_log("JackServerSocket::Close %s", fName); - //shutdown(fSocket, SHUT_RDWR); + shutdown(fSocket, SHUT_RDWR); close(fSocket); unlink(fName); fSocket = -1;