# HG changeset patch # User Jun Wu # Date 1472034247 -3600 # Node ID bff109e6398a97693ab8133739ccbcd42d71cfaa # Parent 1ea77b75d26696a60153e00586546c3dcf3a716f crecord: restore SIGWINCH handler before return Previously, the SIGWINCH handler does not get cleared and if the commit message editor also needs SIGWINCH handling (like vim), the two SIGWINCH handlers (the editor's, ours) will have a race. And we may erase the editor's screen content. This patch restores SIGWINCH handler to address the above issue. diff -r 1ea77b75d266 -r bff109e6398a mercurial/crecord.py --- a/mercurial/crecord.py Sat Aug 20 23:06:01 2016 +0200 +++ b/mercurial/crecord.py Wed Aug 24 11:24:07 2016 +0100 @@ -1263,7 +1263,6 @@ self.statuswin.resize(self.numstatuslines, self.xscreensize) self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1 self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize) - # todo: try to resize commit message window if possible except curses.error: pass @@ -1589,7 +1588,8 @@ method to be wrapped by curses.wrapper() for selecting chunks. """ - signal.signal(signal.SIGWINCH, self.sigwinchhandler) + origsigwinchhandler = signal.signal(signal.SIGWINCH, + self.sigwinchhandler) self.stdscr = stdscr # error during initialization, cannot be printed in the curses # interface, it should be printed by the calling code @@ -1640,3 +1640,4 @@ keypressed = "foobar" if self.handlekeypressed(keypressed): break + signal.signal(signal.SIGWINCH, origsigwinchhandler)