@@ -578,7 +578,7 @@ public: | |||||
CARLA_SAFE_ASSERT_BREAK(data != nullptr); | CARLA_SAFE_ASSERT_BREAK(data != nullptr); | ||||
CarlaString dataBase64 = CarlaString::asBase64(data, dataSize); | CarlaString dataBase64 = CarlaString::asBase64(data, dataSize); | ||||
CARLA_SAFE_ASSERT_RETURN(dataBase64.length() > 0,); | |||||
CARLA_SAFE_ASSERT_BREAK(dataBase64.length() > 0); | |||||
String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName()); | String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName()); | ||||
@@ -651,6 +651,7 @@ public: | |||||
case kPluginBridgeNonRtQuit: | case kPluginBridgeNonRtQuit: | ||||
signalThreadShouldExit(); | signalThreadShouldExit(); | ||||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -868,6 +869,10 @@ protected: | |||||
break; | break; | ||||
} | } | ||||
case kPluginBridgeRtQuit: | |||||
signalThreadShouldExit(); | |||||
break; | |||||
} | } | ||||
} | } | ||||
@@ -383,6 +383,9 @@ public: | |||||
fShmNonRtControl.writeOpcode(kPluginBridgeNonRtQuit); | fShmNonRtControl.writeOpcode(kPluginBridgeNonRtQuit); | ||||
fShmNonRtControl.commitWrite(); | fShmNonRtControl.commitWrite(); | ||||
fShmRtControl.writeOpcode(kPluginBridgeRtQuit); | |||||
fShmRtControl.commitWrite(); | |||||
if (! fTimedOut) | if (! fTimedOut) | ||||
fShmRtControl.waitForServer(3); | fShmRtControl.waitForServer(3); | ||||
} | } | ||||
@@ -274,7 +274,7 @@ void CarlaPluginThread::run() | |||||
// we only get here if UI was closed or thread asked to exit | // we only get here if UI was closed or thread asked to exit | ||||
if (fProcess->isRunning() && shouldThreadExit()) | if (fProcess->isRunning() && shouldThreadExit()) | ||||
{ | { | ||||
//fProcess->waitForFinished(static_cast<int>(fEngine->getOptions().uiBridgesTimeout)); | |||||
fProcess->waitForProcessToFinish(static_cast<int>(fEngine->getOptions().uiBridgesTimeout)); | |||||
if (fProcess->isRunning()) | if (fProcess->isRunning()) | ||||
{ | { | ||||
@@ -309,12 +309,19 @@ void CarlaPluginThread::run() | |||||
carla_sleep(1); | carla_sleep(1); | ||||
// we only get here if bridge crashed or thread asked to exit | // we only get here if bridge crashed or thread asked to exit | ||||
if (shouldThreadExit()) | |||||
if (fProcess->isRunning() && shouldThreadExit()) | |||||
{ | { | ||||
fProcess->getExitCode(); // TEST | |||||
fProcess->waitForProcessToFinish(2000); | |||||
if (fProcess->isRunning()) | if (fProcess->isRunning()) | ||||
{ | |||||
carla_stdout("CarlaPluginThread::run() - bridge refused to close, force kill now"); | |||||
fProcess->kill(); | fProcess->kill(); | ||||
} | |||||
else | |||||
{ | |||||
carla_stdout("CarlaPluginThread::run() - bridge auto-closed successfully"); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -325,6 +325,7 @@ 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: | |||||
gCloseNow = true; | gCloseNow = true; | ||||
break; | break; | ||||
@@ -61,7 +61,8 @@ enum PluginBridgeRtOpcode { | |||||
kPluginBridgeRtControlEventAllSoundOff, // uint/frame, byte/chan | kPluginBridgeRtControlEventAllSoundOff, // uint/frame, byte/chan | ||||
kPluginBridgeRtControlEventAllNotesOff, // uint/frame, byte/chan | kPluginBridgeRtControlEventAllNotesOff, // uint/frame, byte/chan | ||||
kPluginBridgeRtMidiEvent, // uint/frame, byte/port, byte/size, byte[]/data | kPluginBridgeRtMidiEvent, // uint/frame, byte/port, byte/size, byte[]/data | ||||
kPluginBridgeRtProcess | |||||
kPluginBridgeRtProcess, | |||||
kPluginBridgeRtQuit | |||||
}; | }; | ||||
// carla-plugin sends these during non-RT | // carla-plugin sends these during non-RT | ||||
@@ -221,6 +222,8 @@ const char* PluginBridgeRtOpcode2str(const PluginBridgeRtOpcode opcode) noexcept | |||||
return "kPluginBridgeRtMidiEvent"; | return "kPluginBridgeRtMidiEvent"; | ||||
case kPluginBridgeRtProcess: | case kPluginBridgeRtProcess: | ||||
return "kPluginBridgeRtProcess"; | return "kPluginBridgeRtProcess"; | ||||
case kPluginBridgeRtQuit: | |||||
return "kPluginBridgeRtQuit"; | |||||
} | } | ||||
carla_stderr("CarlaBackend::PluginBridgeRtOpcode2str(%i) - invalid opcode", opcode); | carla_stderr("CarlaBackend::PluginBridgeRtOpcode2str(%i) - invalid opcode", opcode); | ||||