AlsaClient::deletePort is incorrect, it calls
ports.remove(port->portId) while it should be doing something like
ports.set(port->portId, nullptr) (shuffling the “ports” array element is forbidden since it is access via the
portId index, which does not change).
(Another way of fixing that would be to replace
OwnedArray<Port> ports with a map that associates a “portId” with a “Port” object)