Trying to insure eventual gc cleanup

This commit is contained in:
itdominator 2023-04-30 23:18:41 -05:00
parent 3a6f0f7478
commit b62b5040c7
3 changed files with 55 additions and 17 deletions

View File

@ -18,7 +18,7 @@ from ...widgets.icon_tree_widget import IconTreeWidget
class GridMixin: class GridMixin:
"""docstring for GridMixin""" """docstring for GridMixin"""
def load_store(self, tab, store, save_state=False): def load_store(self, tab, store, save_state = False):
store.clear() store.clear()
dir = tab.get_current_directory() dir = tab.get_current_directory()
files = tab.get_files() files = tab.get_files()

View File

@ -52,23 +52,41 @@ class TabMixin(GridMixin):
def close_tab(self, button, eve=None): def close_tab(self, button, eve = None):
notebook = button.get_parent().get_parent() notebook = button.get_parent().get_parent()
if notebook.get_n_pages() == 1: if notebook.get_n_pages() == 1:
return return
tab_box = button.get_parent()
wid = int(notebook.get_name()[-1]) wid = int(notebook.get_name()[-1])
tid = self.get_id_from_tab_box(button.get_parent()) tid = self.get_id_from_tab_box(tab_box)
scroll = self.builder.get_object(f"{wid}|{tid}") scroll = self.builder.get_object(f"{wid}|{tid}")
page = notebook.page_num(scroll) icon_grid = scroll.get_children()[0]
store = icon_grid.get_model()
page_num = notebook.page_num(scroll)
tab = self.get_fm_window(wid).get_tab_by_id(tid) tab = self.get_fm_window(wid).get_tab_by_id(tid)
watcher = tab.get_dir_watcher() watcher = tab.get_dir_watcher()
watcher.cancel() watcher.cancel()
self.get_fm_window(wid).delete_tab_by_id(tid) self.get_fm_window(wid).delete_tab_by_id(tid)
notebook.remove_page(page)
store.clear()
icon_grid.destroy()
scroll.destroy()
tab_box.destroy()
notebook.remove_page(page_num)
del page_num
del store
del icon_grid
del scroll
del tab_box
del watcher
del tab
if not settings.is_trace_debug(): if not settings.is_trace_debug():
self.fm_controller.save_state() self.fm_controller.save_state()
self.set_window_title() self.set_window_title()
# NOTE: Not actually getting called even tho set in the glade file... # NOTE: Not actually getting called even tho set in the glade file...

View File

@ -52,21 +52,41 @@ class TabMixin(GridMixin):
self.set_file_watcher(tab) self.set_file_watcher(tab)
def close_tab(self, button, eve=None): def close_tab(self, button, eve = None):
notebook = button.get_parent().get_parent() notebook = button.get_parent().get_parent()
if notebook.get_n_pages() == 1: if notebook.get_n_pages() == 1:
return return
tab_box = button.get_parent()
wid = int(notebook.get_name()[-1]) wid = int(notebook.get_name()[-1])
tid = self.get_id_from_tab_box(button.get_parent()) tid = self.get_id_from_tab_box(tab_box)
scroll = self.builder.get_object(f"{wid}|{tid}") scroll = self.builder.get_object(f"{wid}|{tid}")
page = notebook.page_num(scroll) icon_grid = scroll.get_children()[0]
store = icon_grid.get_model()
page_num = notebook.page_num(scroll)
tab = self.get_fm_window(wid).get_tab_by_id(tid) tab = self.get_fm_window(wid).get_tab_by_id(tid)
watcher = tab.get_dir_watcher() watcher = tab.get_dir_watcher()
watcher.cancel() watcher.cancel()
self.get_fm_window(wid).delete_tab_by_id(tid) self.get_fm_window(wid).delete_tab_by_id(tid)
notebook.remove_page(page)
icon_grid = scroll.get_children()[0]
store = icon_grid.get_model()
store.clear()
icon_grid.destroy()
scroll.destroy()
tab_box.destroy()
notebook.remove_page(page_num)
del page_num
del store
del icon_grid
del scroll
del tab_box
del watcher
del tab
if not settings.is_trace_debug(): if not settings.is_trace_debug():
self.fm_controller.save_state() self.fm_controller.save_state()
self.set_window_title() self.set_window_title()