diff --git a/ChangeLog b/ChangeLog index ac8c42e4..35498a3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,10 @@ John Emmas Jackdmp changes log --------------------------- +2011-11-04 Stephane Letz + + * Fix jack_set_port_name API. + 2011-11-03 Stephane Letz * Add missing jack_client_get_uuid API. diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index daf2eb82..d3338024 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -637,15 +637,14 @@ LIB_EXPORT int jack_port_set_name(jack_port_t* port, const char* name) jack_error("jack_port_set_name called with a NULL port name"); return -1; } else { - JackGraphManager* manager = GetGraphManager(); - int refnum; - if (manager && ((refnum = manager->GetPort(myport)->GetRefNum()) > 0)) { - JackClient* client = JackGlobals::fClientTable[refnum]; - assert(client); - return client->PortRename(myport, name); - } else { - return -1; + JackClient* client = NULL; + for (int i = 0; i < CLIENT_NUM; i++) { + // Find a valid client + if ((client = JackGlobals::fClientTable[i])) { + break; + } } + return (client) ? client->PortRename(myport, name) : -1; } }