From 1afdb860c1c46e283ba970d39717e358eb54cb68 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 24 Sep 2017 08:58:11 +0200 Subject: [PATCH] Cleanup some jack-plugin code --- source/backend/plugin/CarlaPluginJack.cpp | 25 ++++++++--------------- source/interposer/libjack.cpp | 8 ++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/source/backend/plugin/CarlaPluginJack.cpp b/source/backend/plugin/CarlaPluginJack.cpp index b9b4acd1d..1e9001fb7 100644 --- a/source/backend/plugin/CarlaPluginJack.cpp +++ b/source/backend/plugin/CarlaPluginJack.cpp @@ -28,6 +28,7 @@ #include "CarlaBridgeUtils.hpp" #include "CarlaEngineUtils.hpp" #include "CarlaMathUtils.hpp" +#include "CarlaPipeUtils.hpp" #include "CarlaShmUtils.hpp" #include "CarlaThread.hpp" @@ -106,32 +107,24 @@ protected: bool started; { + const EngineOptions& options(kEngine->getOptions()); + char strBuf[STR_MAX+1]; + std::snprintf(strBuf, STR_MAX, P_UINTPTR, options.frontendWinId); strBuf[STR_MAX] = '\0'; - const EngineOptions& options(kEngine->getOptions()); + CarlaString libjackdir(options.binaryDir); + libjackdir += "/jack"; + const ScopedEngineEnvironmentLocker _seel(kEngine); -#ifdef CARLA_OS_LINUX - const char* const oldPreload(std::getenv("LD_PRELOAD")); + const ScopedEnvVar sev1("LD_PRELOAD", nullptr); + const ScopedEnvVar sev2("LD_LIBRARY_PATH", libjackdir.buffer()); - if (oldPreload != nullptr) - ::unsetenv("LD_PRELOAD"); -#endif - - std::snprintf(strBuf, STR_MAX, P_UINTPTR, options.frontendWinId); carla_setenv("CARLA_FRONTEND_WIN_ID", strBuf); carla_setenv("CARLA_SHM_IDS", fShmIds.toRawUTF8()); - carla_setenv("LD_LIBRARY_PATH", "/home/falktx/Personal/FOSS/GIT/falkTX/Carla/bin/jack"); started = fProcess->start(arguments); - -#ifdef CARLA_OS_LINUX - if (oldPreload != nullptr) - ::setenv("LD_PRELOAD", oldPreload, 1); - - ::unsetenv("LD_LIBRARY_PATH"); -#endif } if (! started) diff --git a/source/interposer/libjack.cpp b/source/interposer/libjack.cpp index 8102fd221..6fe02b52e 100644 --- a/source/interposer/libjack.cpp +++ b/source/interposer/libjack.cpp @@ -888,6 +888,14 @@ int jack_client_close(jack_client_t* client) if (--gClientRefCount == 0) { +#if 0 + static bool ignoreFirstClientClose = true; + if (ignoreFirstClientClose) + { + ignoreFirstClientClose = false; + return 0; + } +#endif jclient->close(); delete jclient; gClient = nullptr;