Add more debugging and make sure we don't fall into the trap of iterating over a list we're modifying

This commit is contained in:
Chris Jones 2009-12-09 13:02:13 +00:00
parent 7b24823fd6
commit 24b6082155
1 changed files with 5 additions and 2 deletions

View File

@ -133,6 +133,7 @@ class Notebook(Container, gtk.Notebook):
def wrapcloseterm(self, widget):
"""A child terminal has closed"""
dbg('Notebook::wrapcloseterm: called on %s' % widget)
if self.closeterm(widget):
dbg('Notebook::wrapcloseterm: closeterm succeeded')
if self.get_n_pages() == 1:
@ -164,7 +165,7 @@ class Notebook(Container, gtk.Notebook):
break
if not tabnum:
err('TabLabel::closetab: %s not in %s' % (label, nb))
err('TabLabel::closetab: %s not in %s. Bailing.' % (label, nb))
return
maker = Factory()
@ -196,8 +197,10 @@ class Notebook(Container, gtk.Notebook):
elif maker.isinstance(descendant, 'Terminal'):
objects.append(descendant)
for descendant in objects:
while len(objects) > 0:
descendant = objects.pop()
descendant.close()
# FIXME: Is this mainloop iterations stuff necessary?
while gtk.events_pending():
gtk.main_iteration()
return