[tor-commits] [arm/master] fix: Submenus were crashing when outside window

atagar at torproject.org atagar at torproject.org
Sun Jun 5 04:24:38 UTC 2011


commit d7f1af69b70732ef9f046411b7cf12814a8a62f9
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jun 4 21:22:35 2011 -0700

    fix: Submenus were crashing when outside window
    
    The menus (and any window with a non-zero left position) would crash when it
    attempted to be created outside the screen. Caught by krkhan
---
 src/cli/popups.py |    2 +-
 src/util/panel.py |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cli/popups.py b/src/cli/popups.py
index 52e5376..4bb519d 100644
--- a/src/cli/popups.py
+++ b/src/cli/popups.py
@@ -38,7 +38,7 @@ def init(height = -1, width = -1, top = 0, left = 0, belowStatic = True):
   if popup.win != None:
     panel.CURSES_LOCK.acquire()
     return (popup, popup.maxX - 1, popup.maxY)
-  else: return None
+  else: return (None, 0, 0)
 
 def finalize():
   """
diff --git a/src/util/panel.py b/src/util/panel.py
index 6fae341..70f72a3 100644
--- a/src/util/panel.py
+++ b/src/util/panel.py
@@ -381,7 +381,7 @@ class Panel():
     
     # if the panel's completely outside its parent then this is a no-op
     newHeight, newWidth = self.getPreferredSize()
-    if newHeight == 0:
+    if newHeight == 0 or newWidth == 0:
       self.win = None
       return
     



More information about the tor-commits mailing list