window cleanup at exit

exit_nhwindows() is called before terminate(), and the tty incarnation
destroys all windows--including 'pickinv_cache_win'--without setting
the various index variables used to access them to WIN_ERR, then
terminate() calls freedynamicdata() which calls free_pickinv_cache()
which tries to destroy 'pickinv_cache_win' since it isn't WIN_ERR (if
the perm_invent option has been enabled during that playing session).
Some of the other <interface>_exit_nhwindows() also tear things down
without resetting the variables used to track them, so fixing this in
exit_nhwindows() would have been pretty messy.

Call free_pickinv_cache() before exit_nhwindows() in done().  At the
moment it's only called from done(), so other exit paths won't release
the small chunk(s) of memory used for the alternate inventory window
(if it got created for perm_invent support).
This commit is contained in:
PatR
2015-11-15 00:32:56 -08:00
parent b2ab8f2504
commit d813c6f0ee
3 changed files with 11 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 save.c $NHDT-Date: 1447124658 2015/11/10 03:04:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.93 $ */
/* NetHack 3.6 save.c $NHDT-Date: 1447576350 2015/11/15 08:32:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.94 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1395,7 +1395,7 @@ freedynamicdata()
free_autopickup_exceptions();
/* miscellaneous */
free_pickinv_cache();
/* free_pickinv_cache(); -- done from done()... */
free_symsets();
#endif /* FREE_ALL_MEMORY */
#ifdef STATUS_VIA_WINDOWPORT