Skip to content

Commit

Permalink
- fixed compilation on macOS
Browse files Browse the repository at this point in the history
- fixed crash when using new method with uninitialised routing manager
  • Loading branch information
christoph-hart committed Oct 5, 2024
1 parent 8a0d61f commit a7fa575
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion hi_backend/backend/BackendApplicationCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3292,11 +3292,17 @@ void BackendCommandTarget::Actions::createGlobalCableCppCode(BackendRootWindow*
{
auto rm = dynamic_cast<scriptnode::routing::GlobalRoutingManager*>(bpe->getBackendProcessor()->getGlobalRoutingManager());

if(rm == nullptr)
{
PresetHandler::showMessageWindow("No global cables present", "You need to add global cables before using this method", PresetHandler::IconType::Error);
return;
}

auto cableList = rm->getIdList(scriptnode::routing::GlobalRoutingManager::SlotBase::SlotType::Cable);

if(cableList.isEmpty())
{
PresetHandler::showYesNoWindow("No global cables present", "You need to add global cables before using this method", PresetHandler::IconType::Error);
PresetHandler::showMessageWindow("No global cables present", "You need to add global cables before using this method", PresetHandler::IconType::Error);
return;
}

Expand Down
5 changes: 2 additions & 3 deletions hi_dsp_library/dsp_nodes/RoutingNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1221,18 +1221,17 @@ template <typename... Ts> struct global_cable_cpp_manager: private advanced_tupl
{
virtual ~global_cable_cpp_manager()
{
connectToRuntimeTarget(false, {});
this->connectToRuntimeTarget(false, {});
}

void connectToRuntimeTarget(bool addConnection, const runtime_target::connection& c)
{
static constexpr int size = sizeof...(Ts);
reset_each(addConnection, c, this->getIndexSequence());
}

template <auto CableIndex> void setGlobalCableValue(double value)
{
this->get<(int)CableIndex>().setValue(value);
this->get<(int)CableIndex>().template setValue(value);
}

private:
Expand Down

0 comments on commit a7fa575

Please sign in to comment.