From 9b8394b7017e9ecbc561bdae994d102946b82549 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 2 Dec 2009 22:48:12 +0000 Subject: [PATCH] add a little safety --- terminatorlib/terminator.py | 4 +++- terminatorlib/terminatorterm.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index ae164e6c..095a6c65 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -871,7 +871,7 @@ class Terminator: self.on_destroy_event (parent, gtk.gdk.Event (gtk.gdk.DESTROY)) return True - if isinstance (parent, gtk.Paned): + elif isinstance (parent, gtk.Paned): index = self.term_list.index (widget) grandparent = parent.get_parent () @@ -943,6 +943,8 @@ class Terminator: gdparent.pack2(sibling) if isinstance(sibling, TerminatorTerm) and sibling.conf.titlebars and sibling.conf.extreme_tabs: sibling._titlebox.show() + else: + err('Attempting to remove terminal from unknown parent: %s' % parent) if self.conf.focus_on_close == 'prev' or ( self.conf.focus_on_close == 'auto' and focus_on_close == 'prev'): if index == 0: index = 1 self.term_list[index - 1]._vte.grab_focus () diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index d3537957..ce85ed0f 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1244,6 +1244,8 @@ text/plain '''Returns Gdk.Window.get_position(), pixel-based cursor position, and Gdk.Window.get_geometry()''' reply = dict() + if not self._vte.window: + return reply x, y = self._vte.window.get_origin () reply.setdefault('origin_x',x) reply.setdefault('origin_y',y)