| @@ -25,6 +25,10 @@ | |||||
| # include <signal.h> | # include <signal.h> | ||||
| #endif | #endif | ||||
| #ifdef CARLA_OS_LINUX | |||||
| # include <sys/prctl.h> | |||||
| #endif | |||||
| #ifdef HAVE_X11 | #ifdef HAVE_X11 | ||||
| # include <X11/Xlib.h> | # include <X11/Xlib.h> | ||||
| #endif | #endif | ||||
| @@ -382,6 +386,12 @@ int main(int argc, char* argv[]) | |||||
| rtClientBaseName[6] = '\0'; | rtClientBaseName[6] = '\0'; | ||||
| nonRtClientBaseName[6] = '\0'; | nonRtClientBaseName[6] = '\0'; | ||||
| nonRtServerBaseName[6] = '\0'; | nonRtServerBaseName[6] = '\0'; | ||||
| #ifdef CARLA_OS_LINUX | |||||
| // terminate ourselves if main carla dies | |||||
| ::prctl(PR_SET_PDEATHSIG, SIGTERM); | |||||
| // TODO, osx version too, see https://stackoverflow.com/questions/284325/how-to-make-child-process-die-after-parent-exits | |||||
| #endif | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -20,6 +20,11 @@ | |||||
| #include "CarlaBase64Utils.hpp" | #include "CarlaBase64Utils.hpp" | ||||
| #ifdef CARLA_OS_LINUX | |||||
| # include <signal.h> | |||||
| # include <sys/prctl.h> | |||||
| #endif | |||||
| // needed for atom-util | // needed for atom-util | ||||
| #ifndef nullptr | #ifndef nullptr | ||||
| # undef NULL | # undef NULL | ||||
| @@ -333,6 +338,12 @@ void CarlaBridgeUI::exec(const bool showUI) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fToolkit != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fToolkit != nullptr,); | ||||
| #ifdef CARLA_OS_LINUX | |||||
| // kill ourselves if main carla dies | |||||
| ::prctl(PR_SET_PDEATHSIG, SIGKILL); | |||||
| // TODO, osx version too, see https://stackoverflow.com/questions/284325/how-to-make-child-process-die-after-parent-exits | |||||
| #endif | |||||
| fToolkit->exec(showUI); | fToolkit->exec(showUI); | ||||
| } | } | ||||
| @@ -15,8 +15,8 @@ | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | * For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
| */ | */ | ||||
| // need to include this first | |||||
| #include "libjack.hpp" | #include "libjack.hpp" | ||||
| #include <sys/prctl.h> | |||||
| using juce::File; | using juce::File; | ||||
| using juce::FloatVectorOperations; | using juce::FloatVectorOperations; | ||||
| @@ -51,6 +51,12 @@ public: | |||||
| const char* const libjackSetup(std::getenv("CARLA_LIBJACK_SETUP")); | const char* const libjackSetup(std::getenv("CARLA_LIBJACK_SETUP")); | ||||
| CARLA_SAFE_ASSERT_RETURN(libjackSetup != nullptr && std::strlen(libjackSetup) == 5,); | CARLA_SAFE_ASSERT_RETURN(libjackSetup != nullptr && std::strlen(libjackSetup) == 5,); | ||||
| // make sure we don't get loaded again | |||||
| carla_unsetenv("CARLA_SHM_IDS"); | |||||
| // kill ourselves if main carla dies | |||||
| ::prctl(PR_SET_PDEATHSIG, SIGKILL); | |||||
| for (int i=4; --i >= 0;) { | for (int i=4; --i >= 0;) { | ||||
| CARLA_SAFE_ASSERT_RETURN(libjackSetup[i] >= '0' && libjackSetup[i] <= '0'+64,); | CARLA_SAFE_ASSERT_RETURN(libjackSetup[i] >= '0' && libjackSetup[i] <= '0'+64,); | ||||
| } | } | ||||
| @@ -42,6 +42,9 @@ | |||||
| # include <cerrno> | # include <cerrno> | ||||
| # include <signal.h> | # include <signal.h> | ||||
| # include <sys/wait.h> | # include <sys/wait.h> | ||||
| # ifdef CARLA_OS_LINUX | |||||
| # include <sys/prctl.h> | |||||
| # endif | |||||
| #endif | #endif | ||||
| #ifndef F_SETPIPE_SZ | #ifndef F_SETPIPE_SZ | ||||
| @@ -1490,6 +1493,14 @@ bool CarlaPipeClient::initPipeClient(const char* argv[]) noexcept | |||||
| try { ::close(pipeRecvClient); } CARLA_SAFE_EXCEPTION("close(pipeRecvClient)"); | try { ::close(pipeRecvClient); } CARLA_SAFE_EXCEPTION("close(pipeRecvClient)"); | ||||
| try { ::close(pipeSendClient); } CARLA_SAFE_EXCEPTION("close(pipeSendClient)"); | try { ::close(pipeSendClient); } CARLA_SAFE_EXCEPTION("close(pipeSendClient)"); | ||||
| pipeRecvClient = pipeSendClient = INVALID_PIPE_VALUE; | pipeRecvClient = pipeSendClient = INVALID_PIPE_VALUE; | ||||
| //---------------------------------------------------------------- | |||||
| // kill ourselves if parent dies | |||||
| # ifdef CARLA_OS_LINUX | |||||
| ::prctl(PR_SET_PDEATHSIG, SIGKILL); | |||||
| // TODO, osx version too, see https://stackoverflow.com/questions/284325/how-to-make-child-process-die-after-parent-exits | |||||
| # endif | |||||
| #endif | #endif | ||||
| //---------------------------------------------------------------- | //---------------------------------------------------------------- | ||||