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

@ -57,18 +57,36 @@ class TabMixin(GridMixin):
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

@ -57,16 +57,36 @@ class TabMixin(GridMixin):
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()