hangup paranoia (trunk only)

If nhwindows_hangup() were to get called a second time, it would have
saved hup_exit_nhwindows() as the previous interface's shutdown routine.
Then if/when exit_nhwindows() gets called, hup_exit_nhwindows() would
have called itself with uncontrolled recursion.  So guard against that by
preventing the hangup shutdown routine from ever being saved as previous
interface shutdown routine.

     Also, avoid the exit_windows macro when using it as a pointer rather
than for a function call, since pre-ANSI compilers might be confused by
its expansion.
This commit is contained in:
nethack.rankin
2007-02-03 01:59:49 +00:00
parent 47f052e7b8
commit dda8161ece

View File

@@ -313,8 +313,9 @@ nhwindows_hangup()
/* don't call exit_nhwindows() directly here; if a hangup occurs
while interface code is executing, exit_nhwindows could knock
the interface's active data structures out from under itself */
if (iflags.window_inited)
previnterface_exit_nhwindows = exit_nhwindows;
if (iflags.window_inited &&
windowprocs.win_exit_nhwindows != hup_exit_nhwindows)
previnterface_exit_nhwindows = windowprocs.win_exit_nhwindows;
windowprocs = hup_procs;
}