Attempt at creating widget before loading state

This commit is contained in:
falkTX 2021-11-15 19:35:33 +00:00
parent acc99bef1c
commit 41dddc3bb1
3 changed files with 18 additions and 5 deletions

View file

@ -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())

View file

@ -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

View file

@ -41,6 +41,7 @@
#include <random.hpp>
#include <patch.hpp>
#include <plugin.hpp>
#include <helpers.hpp>
#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<CardinalPluginModelHelper*>(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<CardinalPluginModelHelper*>(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.