From 93579acf27fb99e946bddcc1448f4cfb06e3cf49 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 17 Mar 2019 14:35:01 +0100 Subject: [PATCH] Don't unload plugins that use inlinedisplay Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginInternal.cpp | 5 +++ source/backend/plugin/CarlaPluginInternal.hpp | 1 + source/backend/plugin/CarlaPluginLV2.cpp | 39 ++++++++++++++----- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/source/backend/plugin/CarlaPluginInternal.cpp b/source/backend/plugin/CarlaPluginInternal.cpp index bdc00465f..00d205aa9 100644 --- a/source/backend/plugin/CarlaPluginInternal.cpp +++ b/source/backend/plugin/CarlaPluginInternal.cpp @@ -785,6 +785,11 @@ bool CarlaPlugin::ProtectedData::libClose() noexcept return ret; } +void CarlaPlugin::ProtectedData::setCanDeleteLib(const bool canDelete) noexcept +{ + sLibCounter.setCanDelete(lib, canDelete); +} + bool CarlaPlugin::ProtectedData::uiLibOpen(const char* const fname, const bool canDelete) noexcept { uiLib = sLibCounter.open(fname, canDelete); diff --git a/source/backend/plugin/CarlaPluginInternal.hpp b/source/backend/plugin/CarlaPluginInternal.hpp index 8ab6110b9..a717c418c 100644 --- a/source/backend/plugin/CarlaPluginInternal.hpp +++ b/source/backend/plugin/CarlaPluginInternal.hpp @@ -370,6 +370,7 @@ struct CarlaPlugin::ProtectedData { bool libOpen(const char* const filename) noexcept; bool libClose() noexcept; + void setCanDeleteLib(const bool canDelete) noexcept; bool uiLibOpen(const char* const filename, const bool canDelete) noexcept; bool uiLibClose() noexcept; diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index d2cd702ec..250d3569c 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -593,6 +593,8 @@ public: { carla_debug("CarlaPluginLV2::~CarlaPluginLV2()"); + fInlineDisplayNeedsRedraw = false; + // close UI if (fUI.type != UI::TYPE_NULL) { @@ -1694,16 +1696,24 @@ public: if (fInlineDisplayNeedsRedraw) { - const int64_t timeNow = water::Time::currentTimeMillis(); + // TESTING + CARLA_SAFE_ASSERT(pData->enabled) + CARLA_SAFE_ASSERT(!pData->engine->isAboutToClose()); + CARLA_SAFE_ASSERT(pData->client->isActive()); - if (timeNow - fInlineDisplayLastRedrawTime > (1000 / 30)) + if (pData->enabled && !pData->engine->isAboutToClose() && pData->client->isActive()) { - fInlineDisplayNeedsRedraw = false; - fInlineDisplayLastRedrawTime = timeNow; - pData->engine->callback(true, true, - ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW, - pData->id, - 0, 0, 0, 0.0f, nullptr); + const int64_t timeNow = water::Time::currentTimeMillis(); + + if (timeNow - fInlineDisplayLastRedrawTime > (1000 / 30)) + { + fInlineDisplayNeedsRedraw = false; + fInlineDisplayLastRedrawTime = timeNow; + pData->engine->callback(true, true, + ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW, + pData->id, + 0, 0, 0, 0.0f, nullptr); + } } } @@ -4717,9 +4727,14 @@ public: if (fExt.inlineDisplay != nullptr) { if (fExt.inlineDisplay->render != nullptr) + { pData->hints |= PLUGIN_HAS_INLINE_DISPLAY; + pData->setCanDeleteLib(false); + } else + { fExt.inlineDisplay = nullptr; + } } } @@ -5437,7 +5452,13 @@ public: } // --------------------------------------------------------------- - // get info + // set icon + + if (std::strncmp(fDescriptor->URI, "http://distrho.sf.net/", 22) == 0) + pData->iconName = carla_strdup_safe("distrho"); + + // --------------------------------------------------------------- + // set info if (name != nullptr && name[0] != '\0') pData->name = pData->engine->getUniquePluginName(name);