[tor-commits] [nyx/master] Resizing could cause nyx to crah

atagar at torproject.org atagar at torproject.org
Wed Nov 29 19:58:43 UTC 2017


commit c0276f9efa672dedff6322f04fab4bcb879b2174
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Nov 29 11:57:24 2017 -0800

    Resizing could cause nyx to crah
    
    Another great catch from Dbryrtfbcbhgf...
    
      https://trac.torproject.org/projects/tor/ticket/24382
    
      Traceback (most recent call last):
        File "/usr/local/bin/nyx", line 11, in <module>
          sys.exit(main())
        ...
        File "/usr/local/lib/python3.5/dist-packages/nyx/__init__.py", line 716, in redraw
          panel.redraw(force = force, top = occupied)
        File "/usr/local/lib/python3.5/dist-packages/nyx/panel/__init__.py", line 175, in redraw
          self._last_draw_size = nyx.curses.draw(self._draw, top = self._top, height = self.get_height(), draw_if_resized = draw_dimension)
        File "/usr/local/lib/python3.5/dist-packages/nyx/curses.py", line 740, in draw
          curses_subwindow = CURSES_SCREEN.subwin(subwindow_height, subwindow_width, top, left)
      _curses.error: curses function returned NULL
---
 nyx/curses.py            | 2 ++
 web/changelog/index.html | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/nyx/curses.py b/nyx/curses.py
index 976f625..7a5d074 100644
--- a/nyx/curses.py
+++ b/nyx/curses.py
@@ -747,6 +747,8 @@ def draw(func, left = 0, top = 0, width = None, height = None, background = None
     curses_subwindow.refresh()
 
     return subwindow_dimensions
+  except curses.error:
+    return  # raw curses access, such as subwin, can raise in edge cases such as resizing
   finally:
     CURSES_LOCK.release()
 
diff --git a/web/changelog/index.html b/web/changelog/index.html
index f622f04..94d8886 100644
--- a/web/changelog/index.html
+++ b/web/changelog/index.html
@@ -80,6 +80,12 @@
             <li>Errors when saving the configuration could result in a stacktrace (<b><a href="https://trac.torproject.org/projects/tor/ticket/24409">ticket</a></b>)</li>
           </ul>
         </li>
+
+        <li><span class="component">Curses</span>
+          <ul>
+            <li>Resizing could crash the interface (<b><a href="https://trac.torproject.org/projects/tor/ticket/24382">ticket</a></b>)</li>
+          </ul>
+        </li>
       </ul>
 
       <div id="version-2-0" class="section"></div>



More information about the tor-commits mailing list