fix port listing crash when a port is removed during the listing
Hi.
I meet this crash several times with the method Client.get_ports() :
for port in self.client.get_ports():
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jack.py", line 1598, in get_ports
return self._port_list_from_pointers(names)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jack.py", line 1773, in _port_list_from_pointers
ports.append(self.get_port_by_name(_decode(name)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jack.py", line 1533, in get_port_by_name
raise JackError('Port {0!r} not available'.format(name))
jack.JackError: Port 'Carla-Rack.rack:audio-in1' not available
The port name is not always the same. It happens when I switch from a (ray) session to another, many clients are quitting. It is very very probable that port has been destroyed during listing.
This patch fixes the problem with the choice to not raise any exception in this case, if port has gone, it must not be listed.
Thanks for this PR!
I'm wondering though: you are fixing two things (NULL pointer and unexpected port type), but your description only mentions one problem (AFAIU).
If both fixes are necessary, please describe the second problem.
Maybe one of the problems will go away when #146 is fixed?