fix: disconnect signals and config callbacks on destroy
- dock/main.py: off_config_change in destroy() - switcher/main.py: add destroy() for capture signals + config - panel/main.py: disconnect fullscreen-changed signal - notification_center.py: add destroy() for 4 notification signals
This commit is contained in:
4 files changed
+25
No files matched your search
@@ -176,6 +176,9 @@ class Dock(Window):
|
|||||||
def destroy(self) -> None:
|
def destroy(self) -> None:
|
||||||
self._destroyed = True
|
self._destroyed = True
|
||||||
self._disconnect_occlusion_signals()
|
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:
|
if hasattr(self, "canvas") and self.canvas:
|
||||||
self.canvas.destroy()
|
self.canvas.destroy()
|
||||||
|
|||||||
@@ -1003,6 +1003,16 @@ class NotificationCenter(AppletWindow):
|
|||||||
def _on_escape_pressed(self, *_):
|
def _on_escape_pressed(self, *_):
|
||||||
self.hide()
|
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):
|
def set_visible(self, visible: bool):
|
||||||
"""Control notification center visibility with slide-left animation"""
|
"""Control notification center visibility with slide-left animation"""
|
||||||
super().set_visible(visible)
|
super().set_visible(visible)
|
||||||
|
|||||||
@@ -383,6 +383,7 @@ class Panel(Window):
|
|||||||
"""Clean up all signals and components"""
|
"""Clean up all signals and components"""
|
||||||
try:
|
try:
|
||||||
modus_service.disconnect_by_func(self.on_dnd_changed)
|
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)
|
notification_service.disconnect_by_func(self.on_notification_count_changed)
|
||||||
from services.config import off_config_change
|
from services.config import off_config_change
|
||||||
|
|
||||||
|
|||||||
@@ -578,6 +578,17 @@ class ApplicationSwitcher(Window):
|
|||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("_on_frame_ready error")
|
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):
|
def _on_frame_failed(self, _capture, addr, reason):
|
||||||
full_addr = addr if addr.startswith("0x") else f"0x{addr}"
|
full_addr = addr if addr.startswith("0x") else f"0x{addr}"
|
||||||
logger.debug(f"AppCapture frame-failed for {full_addr}: {reason}")
|
logger.debug(f"AppCapture frame-failed for {full_addr}: {reason}")
|
||||||
|
|||||||
Reference in new issue
Block a user