diff options
author | mathieui <mathieui@mathieui.net> | 2014-04-18 19:18:48 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-04-18 19:18:48 +0200 |
commit | 28d928999d8a3809a245f957c70ea28ca274ffde (patch) | |
tree | 01446d9c3a970d78b0889dbc728ec0ccbbc26b09 /src | |
parent | dc08adf6055ec231869556bfdaed19151a0f3aed (diff) | |
download | poezio-28d928999d8a3809a245f957c70ea28ca274ffde.tar.gz poezio-28d928999d8a3809a245f957c70ea28ca274ffde.tar.bz2 poezio-28d928999d8a3809a245f957c70ea28ca274ffde.tar.xz poezio-28d928999d8a3809a245f957c70ea28ca274ffde.zip |
Fix #2297 (crash after resize)
wrap some curses calls with try/except block
Diffstat (limited to 'src')
-rw-r--r-- | src/core/core.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/core.py b/src/core/core.py index 00d7b9a6..ad9ab264 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -1375,8 +1375,14 @@ class Core(object): with g_lock: self.tab_win.resize(1, tabs.Tab.width, tabs.Tab.height - 2, 0) if config.get('enable_vertical_tab_list', False): - height, width = self.stdscr.getmaxyx() - truncated_win = self.stdscr.subwin(height, config.get('vertical_tab_list_size', 20), 0, 0) + try: + height, _ = self.stdscr.getmaxyx() + truncated_win = self.stdscr.subwin(height, + config.get('vertical_tab_list_size', 20), + 0, 0) + except: + log.error('Curses error on infobar resize', exc_info=True) + return self.left_tab_win = windows.VerticalGlobalInfoBar(truncated_win) else: self.left_tab_win = None @@ -1408,7 +1414,12 @@ class Core(object): # on the left remaining space if config.get('enable_vertical_tab_list', False): with g_lock: - scr = self.stdscr.subwin(0, config.get('vertical_tab_list_size', 20)) + try: + scr = self.stdscr.subwin(0, + config.get('vertical_tab_list_size', 20)) + except: + log.error('Curses error on resize', exc_info=True) + return else: scr = self.stdscr tabs.Tab.resize(scr) |