diff --git a/src/window/dock/main.py b/src/window/dock/main.py index 8198c6a..a8793f6 100644 --- a/src/window/dock/main.py +++ b/src/window/dock/main.py @@ -176,6 +176,9 @@ class Dock(Window): def destroy(self) -> None: self._destroyed = True self._disconnect_occlusion_signals() + from services.config import off_config_change + + off_config_change(self._on_config_change) if hasattr(self, "canvas") and self.canvas: self.canvas.destroy() diff --git a/src/window/notification/notification_center.py b/src/window/notification/notification_center.py index 0b44752..fcdc381 100644 --- a/src/window/notification/notification_center.py +++ b/src/window/notification/notification_center.py @@ -1003,6 +1003,16 @@ class NotificationCenter(AppletWindow): def _on_escape_pressed(self, *_): self.hide() + def destroy(self) -> None: + try: + notification_service.disconnect_by_func(self.on_notification_added) + notification_service.disconnect_by_func(self.on_notification_removed) + notification_service.disconnect_by_func(self.on_clear_all) + notification_service.disconnect_by_func(self.on_count_changed) + except Exception: + pass + super().destroy() + def set_visible(self, visible: bool): """Control notification center visibility with slide-left animation""" super().set_visible(visible) diff --git a/src/window/panel/main.py b/src/window/panel/main.py index 33e9b88..de9fe38 100644 --- a/src/window/panel/main.py +++ b/src/window/panel/main.py @@ -383,6 +383,7 @@ class Panel(Window): """Clean up all signals and components""" try: modus_service.disconnect_by_func(self.on_dnd_changed) + modus_service.disconnect_by_func(self._on_fullscreen_changed) notification_service.disconnect_by_func(self.on_notification_count_changed) from services.config import off_config_change diff --git a/src/window/switcher/main.py b/src/window/switcher/main.py index a5bdf63..1778de0 100644 --- a/src/window/switcher/main.py +++ b/src/window/switcher/main.py @@ -578,6 +578,17 @@ class ApplicationSwitcher(Window): except Exception: logger.exception("_on_frame_ready error") + def destroy(self) -> None: + from services.config import off_config_change + + off_config_change(self._on_config_changed) + try: + self._capture.disconnect_by_func(self._on_frame_ready) + self._capture.disconnect_by_func(self._on_frame_failed) + except Exception: + pass + super().destroy() + def _on_frame_failed(self, _capture, addr, reason): full_addr = addr if addr.startswith("0x") else f"0x{addr}" logger.debug(f"AppCapture frame-failed for {full_addr}: {reason}")