add more debugging to try and figure out the segfault bug

This commit is contained in:
Chris Jones 2008-06-13 11:30:28 +01:00
parent e95f07eb12
commit 2c5a4bd379
1 changed files with 27 additions and 7 deletions

View File

@ -1061,29 +1061,40 @@ class Terminator:
pane = (vertical) and gtk.VPaned () or gtk.HPaned () pane = (vertical) and gtk.VPaned () or gtk.HPaned ()
# get the parent of the provided terminal # get the parent of the provided terminal
parent = widget.get_parent () parent = widget.get_parent ()
dbg ('SEGBUG: add() Got parent')
if isinstance (parent, gtk.Window): if isinstance (parent, gtk.Window):
dbg ('SEGBUG: parent is a gtk.Window')
# We have just one term # We have just one term
widget.reparent (pane) widget.reparent (pane)
dbg ('SEGBUG: reparented widget: %s'%widget)
if pos in ("top", "left"): if pos in ("top", "left"):
dbg ('SEGBUG: pos is in top/left')
pane.remove(widget) pane.remove(widget)
dbg ('SEGBUG: removed widget from pane')
pane.pack1 (terminal, True, True) pane.pack1 (terminal, True, True)
dbg ('SEGBUG: packed terminal')
pane.pack2 (widget, True, True) pane.pack2 (widget, True, True)
dbg ('SEGBUG: packed widget')
else: else:
dbg ('SEGBUG: pos is not in top/left')
pane.pack1 (widget, True, True) pane.pack1 (widget, True, True)
dbg ('SEGBUG: packed widget')
pane.pack2 (terminal, True, True) pane.pack2 (terminal, True, True)
dbg ('SEGBUG: packed terminal')
parent.add (pane) parent.add (pane)
dbg ('SEGBUG: added pane to parent')
position = (vertical) and parent.allocation.height \ position = (vertical) and parent.allocation.height \
or parent.allocation.width or parent.allocation.width
if (isinstance (parent, gtk.Notebook) or isinstance (parent, gtk.Window)) \ if (isinstance (parent, gtk.Notebook) or isinstance (parent, gtk.Window)) and widget.conf.titlebars:
and \
widget.conf.titlebars:
#not the only term in the notebook/window anymore, need to reshow the title #not the only term in the notebook/window anymore, need to reshow the title
dbg ('SEGBUG: Showing _titlebox')
widget._titlebox.show() widget._titlebox.show()
if isinstance (parent, gtk.Notebook): if isinstance (parent, gtk.Notebook):
dbg ('SEGBUG: Parent is a notebook')
page = -1 page = -1
for i in range(0, parent.get_n_pages()): for i in range(0, parent.get_n_pages()):
@ -1106,14 +1117,16 @@ class Terminator:
parent.set_tab_reorderable(pane, True) parent.set_tab_reorderable(pane, True)
parent.set_current_page(page) parent.set_current_page(page)
position = (vertical) and parent.allocation.height \ position = (vertical) and parent.allocation.height \
or parent.allocation.width or parent.allocation.width
if isinstance (parent, gtk.Paned): if isinstance (parent, gtk.Paned):
dbg ('SEGBUG: parent is a Paned')
# We are inside a split term # We are inside a split term
position = (vertical) and widget.allocation.height \ position = (vertical) and widget.allocation.height \
or widget.allocation.width or widget.allocation.width
dbg ('SEGBUG: Preparing to reparent sibling')
if (widget == parent.get_child1 ()): if (widget == parent.get_child1 ()):
widget.reparent (pane) widget.reparent (pane)
parent.pack1 (pane, True, True) parent.pack1 (pane, True, True)
@ -1122,21 +1135,27 @@ class Terminator:
parent.pack2 (pane, True, True) parent.pack2 (pane, True, True)
if pos in ("top", "left"): if pos in ("top", "left"):
dbg ('SEGBUG: pos is in top/left. Removing and re-ordering')
pane.remove(widget) pane.remove(widget)
pane.pack1 (terminal, True, True) pane.pack1 (terminal, True, True)
pane.pack2 (widget, True, True) pane.pack2 (widget, True, True)
else: else:
dbg ('SEGBUG: pos is not in top/left. Packing')
pane.pack1 (widget, True, True) pane.pack1 (widget, True, True)
pane.pack2 (terminal, True, True) pane.pack2 (terminal, True, True)
dbg ('SEGBUG: packing widget and terminal')
pane.pack1 (widget, True, True) pane.pack1 (widget, True, True)
pane.pack2 (terminal, True, True) pane.pack2 (terminal, True, True)
dbg ('SEGBUG: packed widget and terminal')
# show all, set position of the divider # show all, set position of the divider
dbg ('SEGBUG: Showing pane')
pane.show () pane.show ()
dbg ('SEGBUG: Showed pane')
pane.set_position (position / 2) pane.set_position (position / 2)
dbg ('SEGBUG: Set position')
terminal.show () terminal.show ()
# insert the term reference into the list # insert the term reference into the list
index = self.term_list.index (widget) index = self.term_list.index (widget)
@ -1308,6 +1327,7 @@ class Terminator:
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd()) terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
dbg ('SEGBUG: Created TerminatorTerm') dbg ('SEGBUG: Created TerminatorTerm')
pos = vertical and "right" or "bottom" pos = vertical and "right" or "bottom"
dbg ('SEGBUG: Position is: %s'%pos)
self.add(widget, terminal, pos) self.add(widget, terminal, pos)
dbg ('SEGBUG: added TerminatorTerm to container') dbg ('SEGBUG: added TerminatorTerm to container')
terminal.show () terminal.show ()