TTY_PERM_INVENT crash fix
The change 3 weeks ago for #4059 (to fix tty perm_invent memory leak) resulted in nethack crashing during exit if built with TTY_PERM_INVENT enabled and ending the game when perm_invent window isn't displayed. This exits cleanly with or without perm_invent being shown and avoids the memory leak which triggered the prior change.
This commit is contained in:
+2
-2
@@ -1094,7 +1094,7 @@ tty_clear_nhwindow(winid window)
|
|||||||
if (cw->active)
|
if (cw->active)
|
||||||
erase_menu_or_text(window, cw, TRUE);
|
erase_menu_or_text(window, cw, TRUE);
|
||||||
#ifdef TTY_PERM_INVENT
|
#ifdef TTY_PERM_INVENT
|
||||||
if (window == WIN_INVEN)
|
if (cw->type == NHW_MENU && cw->mbehavior == MENU_BEHAVE_PERMINV)
|
||||||
ttyinv_remove_data(cw, FALSE);
|
ttyinv_remove_data(cw, FALSE);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -1989,7 +1989,7 @@ tty_destroy_nhwindow(winid window)
|
|||||||
if (cw->type == NHW_MAP)
|
if (cw->type == NHW_MAP)
|
||||||
term_clear_screen();
|
term_clear_screen();
|
||||||
#ifdef TTY_PERM_INVENT
|
#ifdef TTY_PERM_INVENT
|
||||||
if (cw->type == NHW_PERMINVENT || window == WIN_INVEN)
|
if (cw->type == NHW_MENU && cw->mbehavior == MENU_BEHAVE_PERMINV)
|
||||||
ttyinv_remove_data(cw, TRUE);
|
ttyinv_remove_data(cw, TRUE);
|
||||||
#endif
|
#endif
|
||||||
free_window_info(cw, TRUE);
|
free_window_info(cw, TRUE);
|
||||||
|
|||||||
Reference in New Issue
Block a user