MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / removeModule_NoLock_common

Function removeModule_NoLock_common

src/override/Engine.cpp:781–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779
780
781static void removeModule_NoLock_common(Engine::Internal* internal, Module* module) {
782 // Remove from widgets cache
783 CardinalPluginModelHelper* const helper = dynamic_cast<CardinalPluginModelHelper*>(module->model);
784 DISTRHO_SAFE_ASSERT_RETURN(helper != nullptr,);
785 helper->removeCachedModuleWidget(module);
786 // Dispatch RemoveEvent
787 Module::RemoveEvent eRemove;
788 module->onRemove(eRemove);
789 // Update ParamHandles' module pointers
790 for (ParamHandle* paramHandle : internal->paramHandles) {
791 if (paramHandle->moduleId == module->id)
792 paramHandle->module = NULL;
793 }
794 // If a param is being smoothed on this module, stop smoothing it immediately
795 if (module == internal->smoothModule) {
796 internal->smoothModule = NULL;
797 }
798 // Check that all cables are disconnected
799 for (Cable* cable : internal->cables) {
800 DISTRHO_SAFE_ASSERT(cable->inputModule != module);
801 DISTRHO_SAFE_ASSERT(cable->outputModule != module);
802 }
803 // Update expanders of other modules
804 for (Module* m : internal->modules) {
805 if (m->leftExpander.module == module) {
806 m->leftExpander.moduleId = -1;
807 m->leftExpander.module = NULL;
808 }
809 if (m->rightExpander.module == module) {
810 m->rightExpander.moduleId = -1;
811 m->rightExpander.module = NULL;
812 }
813 }
814 // Reset expanders
815 module->leftExpander.moduleId = -1;
816 module->leftExpander.module = NULL;
817 module->rightExpander.moduleId = -1;
818 module->rightExpander.module = NULL;
819 // Remove module
820 internal->modulesCache.erase(module->id);
821}
822
823
824void Engine::removeModule_NoLock(Module* module) {

Callers 1

removeModule_NoLockMethod · 0.85

Calls 3

eraseMethod · 0.80
onRemoveMethod · 0.45

Tested by

no test coverage detected