]> granicus.if.org Git - nethack/commit
Fix undefined behavior when exiting Curses
authorRay Chason <ray.chason@protonmail.com>
Wed, 28 Sep 2022 00:57:09 +0000 (20:57 -0400)
committerPatR <rankin@nethack.org>
Wed, 28 Sep 2022 21:23:27 +0000 (14:23 -0700)
commit31862b95b033ceba382f1b7188b033c20f860563
tree432ed92634856aa65cc1c9cd9c352e7223f39202
parenta29351f9ce062bb00b733dbe4789d9ec7743437b
Fix undefined behavior when exiting Curses

* When saving: curses_exit_nhwindows calls curses_uncurse_terminal,
  which calls endwin. curses_exit_nhwindows then calls raw_print,
  which calls more Curses functions after endwin has been called.
  Fix this by having curses_raw_print use puts if window_inited
  is false.

* When dying, quitting, etc.: really_done opens the "Goodbye" window,
  which refreshes the other windows when it closes. But the status
  window (and possibly the map and message windows) are gone by that
  point. The window pointers are properly NULLed, but the NULL is then
  passed to touchwin. Fix this by checking window pointers for NULL.
win/curses/cursmain.c
win/curses/curswins.c