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:
17
src/end.c
17
src/end.c
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 end.c $NHDT-Date: 1446510332 2015/11/03 00:25:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.102 $ */
|
/* NetHack 3.6 end.c $NHDT-Date: 1447576343 2015/11/15 08:32:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.103 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -1094,6 +1094,7 @@ die:
|
|||||||
/* clean up unneeded windows */
|
/* clean up unneeded windows */
|
||||||
if (have_windows) {
|
if (have_windows) {
|
||||||
wait_synch();
|
wait_synch();
|
||||||
|
free_pickinv_cache(); /* extra persistent window if perm_invent */
|
||||||
if (WIN_INVEN != WIN_ERR)
|
if (WIN_INVEN != WIN_ERR)
|
||||||
destroy_nhwindow(WIN_INVEN), WIN_INVEN = WIN_ERR;
|
destroy_nhwindow(WIN_INVEN), WIN_INVEN = WIN_ERR;
|
||||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||||
@@ -1122,13 +1123,12 @@ die:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!done_stopprint) {
|
if (!done_stopprint) {
|
||||||
Sprintf(
|
Sprintf(pbuf, "%s %s the %s...", Goodbye(), plname,
|
||||||
pbuf, "%s %s the %s...", Goodbye(), plname,
|
(how != ASCENDED)
|
||||||
how != ASCENDED
|
? (const char *) ((flags.female && urole.name.f)
|
||||||
? (const char *) ((flags.female && urole.name.f)
|
|
||||||
? urole.name.f
|
? urole.name.f
|
||||||
: urole.name.m)
|
: urole.name.m)
|
||||||
: (const char *) (flags.female ? "Demigoddess" : "Demigod"));
|
: (const char *) (flags.female ? "Demigoddess" : "Demigod"));
|
||||||
putstr(endwin, 0, pbuf);
|
putstr(endwin, 0, pbuf);
|
||||||
putstr(endwin, 0, "");
|
putstr(endwin, 0, "");
|
||||||
}
|
}
|
||||||
@@ -1254,10 +1254,9 @@ die:
|
|||||||
putstr(endwin, 0, pbuf);
|
putstr(endwin, 0, pbuf);
|
||||||
}
|
}
|
||||||
if (!done_stopprint) {
|
if (!done_stopprint) {
|
||||||
Sprintf(
|
Sprintf(pbuf,
|
||||||
pbuf,
|
|
||||||
"You were level %d with a maximum of %d hit point%s when you %s.",
|
"You were level %d with a maximum of %d hit point%s when you %s.",
|
||||||
u.ulevel, u.uhpmax, plur(u.uhpmax), ends[how]);
|
u.ulevel, u.uhpmax, plur(u.uhpmax), ends[how]);
|
||||||
putstr(endwin, 0, pbuf);
|
putstr(endwin, 0, pbuf);
|
||||||
putstr(endwin, 0, "");
|
putstr(endwin, 0, "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* 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 */
|
then regrown to full inventory, possibly being resized in the process */
|
||||||
static winid cached_pickinv_win = WIN_ERR;
|
static winid cached_pickinv_win = WIN_ERR;
|
||||||
|
|
||||||
/* #ifdef FREE_ALL_MEMORY */
|
|
||||||
void
|
void
|
||||||
free_pickinv_cache()
|
free_pickinv_cache()
|
||||||
{
|
{
|
||||||
@@ -1994,7 +1993,6 @@ free_pickinv_cache()
|
|||||||
cached_pickinv_win = WIN_ERR;
|
cached_pickinv_win = WIN_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal function used by display_inventory and getobj that can display
|
* Internal function used by display_inventory and getobj that can display
|
||||||
|
|||||||
@@ -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. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -1395,7 +1395,7 @@ freedynamicdata()
|
|||||||
free_autopickup_exceptions();
|
free_autopickup_exceptions();
|
||||||
|
|
||||||
/* miscellaneous */
|
/* miscellaneous */
|
||||||
free_pickinv_cache();
|
/* free_pickinv_cache(); -- done from done()... */
|
||||||
free_symsets();
|
free_symsets();
|
||||||
#endif /* FREE_ALL_MEMORY */
|
#endif /* FREE_ALL_MEMORY */
|
||||||
#ifdef STATUS_VIA_WINDOWPORT
|
#ifdef STATUS_VIA_WINDOWPORT
|
||||||
|
|||||||
Reference in New Issue
Block a user