0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix(utils/bec_dispatcher): _do_disconnect_slot will shutdown consumer of slots/signals which were already disconnected

This commit is contained in:
wyzula-jan
2024-02-22 13:35:57 +01:00
parent 2d9020358d
commit feca7a3dcd

View File

@ -87,8 +87,13 @@ class _BECDispatcher(QObject):
return _Connection(consumer)
def _do_disconnect_slot(self, topic, slot):
print(f"Disconnecting {slot} from {topic}")
connection = self._connections[topic]
connection.signal.disconnect(slot)
try:
connection.signal.disconnect(slot)
except TypeError:
print(f"Could not disconnect slot:'{slot}' from topic:'{topic}'")
print("Continue to remove slot:'{slot}' from 'connection.slots'.")
connection.slots.remove(slot)
if not connection.slots:
print(f"{connection.consumer} is shutting down")