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

+13
View File
@@ -88,3 +88,16 @@ class ModusDropdown(PopupWindow):
return
self.set_visible(False)
modus_service.dropdowns_hide = not modus_service.dropdowns_hide
def destroy(self):
"""Clean up resources and global references"""
global dropdowns
if self in dropdowns:
dropdowns.remove(self)
try:
modus_service.disconnect_by_func(self.hide_dropdown)
except Exception:
pass
super().destroy()
+22
View File
@@ -299,3 +299,25 @@ class DropDownMouseCapture(MouseCapture):
if modus_service.current_dropdown == self.child_window.id:
return
return self.hide_child_window(widget, event)
def destroy(self):
"""Clean up signal connections"""
try:
modus_service.disconnect_by_func(self.dropdowns_hide_changed)
except Exception:
pass
super().destroy()
def add_destroy_to_mousecapture():
# Base MouseCapture
def mc_destroy(self):
# Child window should be destroyed by its owner, but we should null references
self.child_window = None
Window.destroy(self)
MouseCapture.destroy = mc_destroy
# Apply destroy to base class
add_destroy_to_mousecapture()