diff --git a/plugins/Cardinal/src/Ildaeil.cpp b/plugins/Cardinal/src/Ildaeil.cpp index b241339..b206856 100644 --- a/plugins/Cardinal/src/Ildaeil.cpp +++ b/plugins/Cardinal/src/Ildaeil.cpp @@ -31,6 +31,8 @@ # include "ImGuiWidget.hpp" # include "extra/ScopedPointer.hpp" # include "extra/Thread.hpp" +#else +# include "extra/Mutex.hpp" #endif #include "CarlaNativePlugin.h" @@ -674,15 +676,15 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread { { if (module->fCarlaHostHandle != nullptr) { - module->fUI = nullptr; + if (idleCallbackActive) + module->pcontext->removeIdleCallback(this); if (fPluginRunning) carla_show_custom_ui(module->fCarlaHostHandle, 0, false); carla_set_engine_option(module->fCarlaHostHandle, ENGINE_OPTION_FRONTEND_WIN_ID, 0, "0"); - if (idleCallbackActive) - module->pcontext->removeIdleCallback(this); + module->fUI = nullptr; } if (isThreadRunning()) diff --git a/src/Makefile b/src/Makefile index ec81590..9545eed 100644 --- a/src/Makefile +++ b/src/Makefile @@ -121,6 +121,7 @@ RACK_FILES += $(filter-out $(IGNORED_FILES), $(wildcard Rack/src/*/*.cpp)) # -------------------------------------------------------------- # lots of warnings from VCV side +BASE_FLAGS += -Wno-unknown-warning-option BASE_FLAGS += -Wno-unused-but-set-variable BASE_FLAGS += -Wno-unused-parameter BASE_FLAGS += -Wno-unused-result diff --git a/src/override/Engine.cpp b/src/override/Engine.cpp index 92739a3..c4bda2e 100644 --- a/src/override/Engine.cpp +++ b/src/override/Engine.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #ifdef NDEBUG # undef DEBUG @@ -585,6 +586,9 @@ void Engine::removeModule_NoLock(Module* module) { m->rightExpander.module = NULL; } } + // Remove from widgets cache + if (auto* const helper = reinterpret_cast(module->model)) + helper->clearCachedModuleWidget(module); // Remove module internal->modulesCache.erase(module->id); internal->modules.erase(it); @@ -981,8 +985,14 @@ void Engine::fromJson(json_t* rootJ) { } // Create module - Module* module = model->createModule(); - DISTRHO_SAFE_ASSERT_RETURN(module,); + Module* const module = model->createModule(); + DISTRHO_SAFE_ASSERT_CONTINUE(module != nullptr); + + // Create the widget too, needed by a few modules + auto* const helper = reinterpret_cast(model); + DISTRHO_SAFE_ASSERT_CONTINUE(helper != nullptr); + + helper->createCachedModuleWidget(module); try { // This doesn't need a lock because the Module is not added to the Engine yet.