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 invent.c $NHDT-Date: 1446516832 2015/11/03 02:13:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.178 $ */
/* NetHack 3.6 invent.c $NHDT-Date: 1447576348 2015/11/15 08:32:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.179 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1985,7 +1985,6 @@ struct obj *list, **last_found;
then regrown to full inventory, possibly being resized in the process */
static winid cached_pickinv_win = WIN_ERR;
/* #ifdef FREE_ALL_MEMORY */
void
free_pickinv_cache()
{
@@ -1994,7 +1993,6 @@ free_pickinv_cache()
cached_pickinv_win = WIN_ERR;
}
}
/* #endif */
/*
* Internal function used by display_inventory and getobj that can display