Fix Memory Leak(maybe??)

This commit is contained in:
tr1x_em committed 2025-08-07 11:21:36 +05:30
1 parent 8e4ef78cd7
commit 84af1ab3bc
5 files changed
+396 -138

No files matched your search

+16
View File
@@ -132,6 +132,22 @@ class PlayerBoxStack(Box):
super().destroy()
def _periodic_cleanup(self):
"""Light cleanup for reuse - clean internal state but preserve widget"""
try:
# Reset to no media state
self.player_stack.children = [self.no_media_box]
# Clear player buttons but don't destroy them
self.player_buttons.clear()
# Reset stack position
self.current_stack_pos = 0
logger.debug("PlayerBoxStack periodic cleanup completed")
except Exception as e:
logger.warning(f"PlayerBoxStack periodic cleanup failed: {e}")
def _create_no_media_box(self):
"""Create a placeholder box for when no media is playing."""
fallback_cover_path = f"{data.HOME_DIR}/.current.wall"