fix(device_input): ensure callback is removed after cleanup

This commit is contained in:
2026-05-21 13:39:19 +02:00
committed by Jan Wyzula
parent a976837cff
commit d99db7d042
4 changed files with 58 additions and 2 deletions
@@ -489,14 +489,17 @@ class DeviceComboBox(BECWidget, QComboBox):
action: Device update action emitted by BEC.
content: Device update payload. Currently unused.
"""
if self._callback_id is None or getattr(self, "_destroyed", False):
return
if action in ["add", "remove", "reload"]:
self.device_config_update.emit()
def cleanup(self):
"""Cleanup the widget."""
if self._callback_id is not None:
self.bec_dispatcher.client.callbacks.remove(self._callback_id)
callback_id = self._callback_id
self._callback_id = None
self.bec_dispatcher.client.callbacks.remove(callback_id)
super().cleanup()
def get_current_device(self) -> object:
@@ -594,8 +594,9 @@ class SignalComboBox(BECWidget, QComboBox):
def cleanup(self):
"""Cleanup the widget."""
if self._device_update_register is not None:
self.bec_dispatcher.client.callbacks.remove(self._device_update_register)
callback_id = self._device_update_register
self._device_update_register = None
self.bec_dispatcher.client.callbacks.remove(callback_id)
super().cleanup()
@staticmethod