Move the tabbar destroy logic into the tab bar class

This commit is contained in:
Kovid Goyal 2017-11-01 12:49:00 +05:30
parent 27701351e1
commit 6cbd1d1727
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 3 deletions

View File

@ -263,11 +263,10 @@ class Boss:
self.child_monitor.shutdown()
wakeup()
self.child_monitor.join()
for t in self.tab_manager:
t.destroy()
del self.tab_manager
self.tab_manager.destroy()
destroy_sprite_map()
destroy_global_data()
del self.tab_manager
del self.glfw_window
def paste_to_active_window(self, text):

View File

@ -285,6 +285,10 @@ class TabBar: # {{{
self.cell_ranges = cr
glfw_post_empty_event()
def destroy(self):
self.screen.reset_callbacks()
del self.screen
def tab_at(self, x):
x = (x - self.window_geometry.left) // self.cell_width
for i, (a, b) in enumerate(self.cell_ranges):
@ -412,4 +416,11 @@ class TabManager: # {{{
if len(self.tabs) < 2:
return
self.tab_bar.render()
def destroy(self):
for t in self:
t.destroy()
self.tab_bar.destroy()
del self.tab_bar
del self.refresh_sprite_positions
# }}}