Ensure Tab.destroy is only called once
This commit is contained in:
parent
de2c1deb97
commit
67ad2c4395
@ -67,7 +67,6 @@ class Boss(Thread):
|
||||
Thread.__init__(self, name='ChildMonitor')
|
||||
self.cursor_blinking = True
|
||||
self.glfw_window_title = None
|
||||
self.current_tab_bar_height = 0
|
||||
self.action_queue = Queue()
|
||||
self.pending_resize = True
|
||||
self.resize_gl_viewport = False
|
||||
@ -116,6 +115,10 @@ class Boss(Thread):
|
||||
self.glfw_window.set_should_close(True)
|
||||
glfw_post_empty_event()
|
||||
|
||||
@property
|
||||
def current_tab_bar_height(self):
|
||||
return self.tab_manager.tab_bar_height
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.tab_manager)
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
from collections import deque
|
||||
|
||||
from .child import Child
|
||||
from .constants import get_boss, appname, shell_path
|
||||
from .constants import get_boss, appname, shell_path, cell_size
|
||||
from .fast_data_types import glfw_post_empty_event
|
||||
from .layout import all_layouts
|
||||
from .borders import Borders
|
||||
@ -118,9 +118,10 @@ class Tab:
|
||||
return window in self.windows
|
||||
|
||||
def destroy(self):
|
||||
for w in self.windows:
|
||||
w.destroy()
|
||||
del self.windows
|
||||
if hasattr(self, 'windows'):
|
||||
for w in self.windows:
|
||||
w.destroy()
|
||||
del self.windows
|
||||
|
||||
def render(self):
|
||||
self.borders.render(get_boss().borders_program)
|
||||
@ -142,6 +143,10 @@ class TabManager:
|
||||
def active_tab(self):
|
||||
return self.tabs[0] if self.tabs else None
|
||||
|
||||
@property
|
||||
def tab_bar_height(self):
|
||||
return 0 if len(self.tabs) < 1 else cell_size.height
|
||||
|
||||
def remove(self, tab):
|
||||
' Must be called in the GUI thread '
|
||||
self.tabs.remove(tab)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user