related to memory leak

This commit is contained in:
sankalp committed 2026-04-23 16:09:52 +05:45
1 parent 7eb21daf2f
commit 6577c19dcb
25 files changed
+610 -68

No files matched your search

+10
View File
@@ -98,3 +98,13 @@ class AudioOSDContainer(BaseOSDContainer):
def update(self, *_):
self._update_display()
super().update()
def destroy(self):
"""Disconnect signals from Audio service"""
try:
self.audio.disconnect_by_func(self._on_speaker_changed)
if self.audio.speaker:
self.audio.speaker.disconnect_by_func(self._on_speaker_stream_changed)
except Exception:
pass
super().destroy()
+4
View File
@@ -29,6 +29,10 @@ class BaseOSDContainer(Box):
self.window.connect("leave-notify-event", self._on_leave_notify)
return False
def destroy(self):
self.cleanup_all_handlers()
super().destroy()
def _on_enter_notify(self, widget, event):
if event.detail != Gdk.NotifyType.INFERIOR:
self._is_hovered = True
+10
View File
@@ -57,3 +57,13 @@ class BrightnessOSDContainer(BaseOSDContainer):
def update(self, *_):
self._update_display()
super().update()
def destroy(self):
"""Disconnect signals from Brightness service"""
try:
self.brightness_service.disconnect_by_func(
self._on_screen_brightness_changed
)
except Exception:
pass
super().destroy()
+8
View File
@@ -45,3 +45,11 @@ class CapsLockOSDContainer(BaseOSDContainer):
def update(self, *_):
# We don't need a separate display update here as it's handled in the signal
super().update()
def destroy(self):
"""Disconnect signals from CapsLock service"""
try:
self.capslock.disconnect_by_func(self._on_caps_lock_state_changed)
except Exception:
pass
super().destroy()
@@ -37,3 +37,11 @@ class KeyboardLayoutOSDContainer(BaseOSDContainer):
def update(self, *_):
self.label.set_text(self.keyboard_layout.current_layout)
super().update()
def destroy(self):
"""Disconnect signals from KeyboardLayout service"""
try:
self.keyboard_layout.disconnect_by_func(self._on_layout_changed)
except Exception:
pass
super().destroy()
+12
View File
@@ -98,3 +98,15 @@ class MicrophoneOSDContainer(BaseOSDContainer):
def update(self, *_):
self._update_display()
super().update()
def destroy(self):
"""Disconnect signals from Audio service"""
try:
self.audio.disconnect_by_func(self._on_microphone_changed)
if self.audio.microphone:
self.audio.microphone.disconnect_by_func(
self._on_microphone_stream_changed
)
except Exception:
pass
super().destroy()