From 358edf5d2d47a9e17b992fa01e1fb8b5e7b27ad8 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 24 Jan 2015 17:02:30 +0000 Subject: [PATCH] Add some precautions about closing LV2 UIs; Fix typo --- source/backend/plugin/CarlaPluginLV2.cpp | 17 +++++++++++------ source/carla_backend.py | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index 15a5b2ae5..dae7a44e5 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -1477,7 +1477,8 @@ public: uint32_t portIndex; const LV2_Atom* atom; - const bool hasPortEvent(fUI.handle != nullptr && fUI.descriptor != nullptr && fUI.descriptor->port_event != nullptr); + const bool hasPortEvent(fUI.handle != nullptr && fUI.descriptor != nullptr && + fUI.descriptor->port_event != nullptr && ! fNeedsUiClose); for (; tmpRingBuffer.get(atom, portIndex);) { @@ -1540,7 +1541,11 @@ public: if (fNeedsUiClose) pass(); else if (fUI.handle != nullptr && fExt.uiidle != nullptr && fExt.uiidle->idle(fUI.handle) != 0) - fNeedsUiClose = true; + { + showCustomUI(false); + pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); + CARLA_SAFE_ASSERT(fUI.handle == nullptr); + } #endif } @@ -3936,7 +3941,7 @@ public: } else { - if (fUI.handle != nullptr && fUI.descriptor != nullptr && fUI.descriptor->port_event != nullptr) + if (fUI.handle != nullptr && fUI.descriptor != nullptr && fUI.descriptor->port_event != nullptr && ! fNeedsUiClose) { CARLA_SAFE_ASSERT_RETURN(pData->param.data[index].rindex >= 0,); fUI.descriptor->port_event(fUI.handle, static_cast(pData->param.data[index].rindex), sizeof(float), CARLA_URI_MAP_ID_NULL, &value); @@ -3956,7 +3961,7 @@ public: } else { - if (fExt.uiprograms != nullptr && fExt.uiprograms->select_program != nullptr) + if (fExt.uiprograms != nullptr && fExt.uiprograms->select_program != nullptr && ! fNeedsUiClose) fExt.uiprograms->select_program(fUI.handle, pData->midiprog.data[index].bank, pData->midiprog.data[index].program); } } @@ -3975,7 +3980,7 @@ public: } else { - if (fUI.handle != nullptr && fUI.descriptor != nullptr && fUI.descriptor->port_event != nullptr && fEventsIn.ctrl != nullptr) + if (fUI.handle != nullptr && fUI.descriptor != nullptr && fUI.descriptor->port_event != nullptr && fEventsIn.ctrl != nullptr && ! fNeedsUiClose) { LV2_Atom_MidiEvent midiEv; midiEv.atom.type = CARLA_URI_MAP_ID_MIDI_EVENT; @@ -4002,7 +4007,7 @@ public: } else { - if (fUI.handle != nullptr && fUI.descriptor != nullptr && fUI.descriptor->port_event != nullptr && fEventsIn.ctrl != nullptr) + if (fUI.handle != nullptr && fUI.descriptor != nullptr && fUI.descriptor->port_event != nullptr && fEventsIn.ctrl != nullptr && ! fNeedsUiClose) { LV2_Atom_MidiEvent midiEv; midiEv.atom.type = CARLA_URI_MAP_ID_MIDI_EVENT; diff --git a/source/carla_backend.py b/source/carla_backend.py index a3f8863c4..0ff9b1f3a 100644 --- a/source/carla_backend.py +++ b/source/carla_backend.py @@ -2427,7 +2427,7 @@ class CarlaHostDLL(CarlaHostMeta): cfilename = filename.encode("utf-8") if filename else None cname = name.encode("utf-8") if name else None clabel = label.encode("utf-8") if label else None - return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p)), options) + return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p), options)) def remove_plugin(self, pluginId): return bool(self.lib.carla_remove_plugin(pluginId))