Browse Source

bridge: ignore SIGTERM signal when running as child client

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.5
falkTX 1 year ago
parent
commit
8288d5fcc2
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      source/bridges-plugin/CarlaBridgePlugin.cpp

+ 10
- 7
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -72,13 +72,14 @@ using water::String;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------


static bool gIsInitiated = false; static bool gIsInitiated = false;
static volatile bool gCloseNow = false;
static volatile bool gCloseBridge = false;
static volatile bool gCloseSignal = false;
static volatile bool gSaveNow = false; static volatile bool gSaveNow = false;


#if defined(CARLA_OS_UNIX) #if defined(CARLA_OS_UNIX)
static void closeSignalHandler(int) noexcept static void closeSignalHandler(int) noexcept
{ {
gCloseNow = true;
gCloseSignal = true;
} }
static void saveSignalHandler(int) noexcept static void saveSignalHandler(int) noexcept
{ {
@@ -89,7 +90,7 @@ static BOOL WINAPI winSignalHandler(DWORD dwCtrlType) noexcept
{ {
if (dwCtrlType == CTRL_C_EVENT) if (dwCtrlType == CTRL_C_EVENT)
{ {
gCloseNow = true;
gCloseSignal = true;
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@@ -229,7 +230,7 @@ public:
gIsInitiated = true; gIsInitiated = true;


#if defined(USING_JUCE) && (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)) #if defined(USING_JUCE) && (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN))
CarlaJUCE::setupAndUseMainApplication(gIdle, &gCloseNow);
CarlaJUCE::setupAndUseMainApplication(gIdle, &gCloseSignal);
#else #else
int64_t timeToEnd = 0; int64_t timeToEnd = 0;


@@ -239,7 +240,7 @@ public:
fEngine->transportPlay(); fEngine->transportPlay();
} }


for (; runMainLoopOnce() && ! gCloseNow;)
for (; runMainLoopOnce() && ! gCloseBridge;)
{ {
gIdle(); gIdle();
# if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) # if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
@@ -250,6 +251,8 @@ public:
# endif # endif
if (testing && timeToEnd - water::Time::currentTimeMillis() < 0) if (testing && timeToEnd - water::Time::currentTimeMillis() < 0)
break; break;
if (gCloseSignal && ! fUsingBridge)
break;
} }
#endif #endif


@@ -270,12 +273,12 @@ protected:
case ENGINE_CALLBACK_ENGINE_STOPPED: case ENGINE_CALLBACK_ENGINE_STOPPED:
case ENGINE_CALLBACK_PLUGIN_REMOVED: case ENGINE_CALLBACK_PLUGIN_REMOVED:
case ENGINE_CALLBACK_QUIT: case ENGINE_CALLBACK_QUIT:
gCloseNow = true;
gCloseBridge = gCloseSignal = true;
break; break;


case ENGINE_CALLBACK_UI_STATE_CHANGED: case ENGINE_CALLBACK_UI_STATE_CHANGED:
if (gIsInitiated && value1 != 1 && ! fUsingBridge) if (gIsInitiated && value1 != 1 && ! fUsingBridge)
gCloseNow = true;
gCloseBridge = gCloseSignal = true;
break; break;


default: default:


Loading…
Cancel
Save