Index: common/JackEngine.cpp =================================================================== --- common/JackEngine.cpp (revision 2297) +++ common/JackEngine.cpp (working copy) @@ -562,22 +562,22 @@ refnum, (client->GetClientControl()) ? client->GetClientControl()->fName : "No name"); - // Remove the client from the table - ReleaseRefnum(refnum); - // Notify unregister jack_int_t ports[PORT_NUM_FOR_CLIENT]; int i; fGraphManager->GetInputPorts(refnum, ports); for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) { - NotifyPortRegistation(ports[i], false); + PortUnRegister(refnum, ports[i]); } fGraphManager->GetOutputPorts(refnum, ports); for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) { - NotifyPortRegistation(ports[i], false); + PortUnRegister(refnum, ports[i]); } + + // Remove the client from the table + ReleaseRefnum(refnum); // Remove all ports fGraphManager->RemoveAllPorts(refnum); @@ -626,6 +626,20 @@ return -1; jack_log("JackEngine::ClientDeactivate ref = %ld name = %s", refnum, client->GetClientControl()->fName); + + // Disconnect ports + jack_int_t ports[PORT_NUM_FOR_CLIENT]; + int i; + fGraphManager->GetInputPorts(refnum, ports); + for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) { + PortDisconnect(refnum, ports[i], ALL_PORTS); + } + + fGraphManager->GetOutputPorts(refnum, ports); + for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) { + PortDisconnect(refnum, ports[i], ALL_PORTS); + } + fGraphManager->Deactivate(refnum); fLastSwitchUsecs = 0; // Force switch to occur next cycle, even when called with "dead" clients @@ -666,6 +680,8 @@ { jack_log("JackEngine::PortUnRegister ref = %ld port_index = %ld", refnum, port_index); assert(fClientTable[refnum]); + + PortDisconnect(refnum, port_index, ALL_PORTS); if (fGraphManager->ReleasePort(refnum, port_index) == 0) { NotifyPortRegistation(port_index, false); Index: common/JackGraphManager.cpp =================================================================== --- common/JackGraphManager.cpp (revision 2297) +++ common/JackGraphManager.cpp (working copy) @@ -477,8 +477,6 @@ // Server void JackGraphManager::Deactivate(int refnum) { - DisconnectAllPorts(refnum); - // Disconnect only when needed if (IsDirectConnection(refnum, FREEWHEEL_DRIVER_REFNUM)) { DirectDisconnect(refnum, FREEWHEEL_DRIVER_REFNUM);