diff --git a/common/JackClient.cpp b/common/JackClient.cpp index b426665f..fd12bc22 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -585,19 +585,22 @@ inline void JackClient::ExecuteThread() inline jack_nframes_t JackClient::CycleWaitAux() { - if (!WaitSync()) + if (!WaitSync()) { Error(); // Terminates the thread + } CallSyncCallbackAux(); return GetEngineControl()->fBufferSize; } inline void JackClient::CycleSignalAux(int status) { - if (status == 0) + if (status == 0) { CallTimebaseCallbackAux(); + } SignalSync(); - if (status != 0) + if (status != 0) { End(); // Terminates the thread + } } jack_nframes_t JackClient::CycleWait() @@ -784,8 +787,9 @@ inline int JackClient::ActivateAux() jack_log("JackClient::ActivateAux"); // RT thread is started - if (StartThread() < 0) + if (StartThread() < 0) { return -1; + } int result = -1; GetClientControl()->fCallback[kRealTimeCallback] = IsRealTime(); @@ -1045,8 +1049,9 @@ int JackClient::SetSampleRateCallback(JackSampleRateCallback callback, void *arg fSampleRateArg = arg; fSampleRate = callback; // Now invoke it - if (callback) + if (callback) { callback(GetEngineControl()->fSampleRate, arg); + } return 0; } } @@ -1125,7 +1130,7 @@ int JackClient::SetProcessThread(JackThreadCallback fun, void *arg) jack_error("You cannot set callbacks on an active client"); return -1; } else if (fProcess) { - jack_error ("A process callback has already been setup, both models cannot be used at the same time!"); + jack_error("A process callback has already been setup, both models cannot be used at the same time!"); return -1; } else { fThreadFun = fun; diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index d09ea35e..32cc2990 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -696,10 +696,8 @@ error: int JackEngine::ClientExternalClose(int refnum) { jack_log("JackEngine::ClientExternalClose ref = %ld", refnum); - JackClientInterface* client = fClientTable[refnum]; - fEngineControl->fTransport.ResetTimebase(refnum); - int res = ClientCloseAux(refnum, client, true); + int res = ClientCloseAux(refnum, true); client->Close(); delete client; return res; @@ -709,15 +707,15 @@ int JackEngine::ClientExternalClose(int refnum) int JackEngine::ClientInternalClose(int refnum, bool wait) { jack_log("JackEngine::ClientInternalClose ref = %ld", refnum); - - JackClientInterface* client = fClientTable[refnum]; - fEngineControl->fTransport.ResetTimebase(refnum); - return ClientCloseAux(refnum, client, wait); + return ClientCloseAux(refnum, wait); } -int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wait) +int JackEngine::ClientCloseAux(int refnum, bool wait) { jack_log("JackEngine::ClientCloseAux ref = %ld", refnum); + + JackClientInterface* client = fClientTable[refnum]; + fEngineControl->fTransport.ResetTimebase(refnum); // Unregister all ports ==> notifications are sent jack_int_t ports[PORT_NUM_FOR_CLIENT]; diff --git a/common/JackEngine.h b/common/JackEngine.h index d54b7141..ebd3eb1b 100644 --- a/common/JackEngine.h +++ b/common/JackEngine.h @@ -61,7 +61,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble std::map fReservationMap; int fMaxUUID; - int ClientCloseAux(int refnum, JackClientInterface* client, bool wait); + int ClientCloseAux(int refnum, bool wait); void CheckXRun(jack_time_t callback_usecs); int NotifyAddClient(JackClientInterface* new_client, const char* new_name, int refnum);