From 5114ce787bea63cc906f8e73492771d4797c5262 Mon Sep 17 00:00:00 2001 From: Cam Gorrie Date: Mon, 17 Aug 2026 23:21:55 -0400 Subject: [PATCH] Prune stale connections when MIDI mode changes set_midi_devices_change_mode gave the combined "in;out" device symbol to remove_port_from_connections, which matches against single JACK port names. A combined symbol never matches, so nothing was removed from self.connections and nothing was disconnected in JACK. mod-host tears those JACK edges down itself in effects_aggregated_midi_enable (steps 1 and 2), so after a switch to aggregated mode self.connections held edges that no longer existed. connect() then short-circuits on its "already exists" guard: the user drags a cable, gets HTTP true, and no connection is ever made. Switching back to separated mode does not clear it, so the cable can never be created again in that session. Split the symbol first, as set_midi_devices_separated already does for the same data. Co-Authored-By: Claude Opus 5 --- mod/host.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mod/host.py b/mod/host.py index 1273935e0..6f92bbb5b 100644 --- a/mod/host.py +++ b/mod/host.py @@ -6933,13 +6933,18 @@ def set_midi_devices_change_mode(self, midi_aggregated_mode): # Remove USB MIDI ports for port_symbol, port_alias, port_conns in self.midiports: - self.remove_port_from_connections(port_symbol) - + # port_symbol can be a combined "in;out" pair. Give each half to + # remove_port_from_connections separately: it matches against single + # JACK port names, so a combined symbol never matches and leaves + # self.connections holding edges that mod-host has already removed. if ";" in port_symbol: inp, outp = port_symbol.split(";",1) + self.remove_port_from_connections(inp) + self.remove_port_from_connections(outp) self.msg_callback("remove_hw_port /graph/%s" % (inp.split(":",1)[-1])) self.msg_callback("remove_hw_port /graph/%s" % (outp.split(":",1)[-1])) else: + self.remove_port_from_connections(port_symbol) self.msg_callback("remove_hw_port /graph/%s" % (port_symbol.split(":",1)[-1])) self.midiports = []