When deleting windows and screens, also set to NULL the standard names

that refer to the window or screen just deleted.
Add some more debugging information.
This commit is contained in:
jdc 2006-08-23 19:23:14 +00:00
parent c4b88fb280
commit ed312f0773
2 changed files with 19 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: delwin.c,v 1.13 2003/08/07 16:44:21 agc Exp $ */
/* $NetBSD: delwin.c,v 1.14 2006/08/23 19:23:14 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)delwin.c 8.2 (Berkeley) 5/4/94";
#else
__RCSID("$NetBSD: delwin.c,v 1.13 2003/08/07 16:44:21 agc Exp $");
__RCSID("$NetBSD: delwin.c,v 1.14 2006/08/23 19:23:14 jdc Exp $");
#endif
#endif /* not lint */
@ -54,6 +54,9 @@ delwin(WINDOW *win)
struct __winlist *wl, *pwl;
SCREEN *screen;
#ifdef DEBUG
__CTRACE("delwin(%p)\n", win);
#endif
if (win->orig == NULL) {
/*
* If we are the original window, delete the space for all
@ -92,6 +95,12 @@ delwin(WINDOW *win)
}
free(win->lspace);
free(win->lines);
if (win == _cursesi_screen->curscr)
_cursesi_screen->curscr = NULL;
if (win == _cursesi_screen->stdscr)
_cursesi_screen->stdscr = NULL;
if (win == _cursesi_screen->__virtscr)
_cursesi_screen->__virtscr = NULL;
free(win);
return (OK);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: screen.c,v 1.17 2004/03/23 21:17:20 jdc Exp $ */
/* $NetBSD: screen.c,v 1.18 2006/08/23 19:23:14 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)screen.c 8.2 (blymn) 11/27/2001";
#else
__RCSID("$NetBSD: screen.c,v 1.17 2004/03/23 21:17:20 jdc Exp $");
__RCSID("$NetBSD: screen.c,v 1.18 2006/08/23 19:23:14 jdc Exp $");
#endif
#endif /* not lint */
@ -201,6 +201,9 @@ delscreen(SCREEN *screen)
{
struct __winlist *list;
#ifdef DEBUG
__CTRACE("delscreen(%p)\n", screen);
#endif
/* free up the termcap entry stuff */
t_freent(screen->cursesi_genbuf);
@ -216,5 +219,8 @@ delscreen(SCREEN *screen)
_cursesi_free_keymap(screen->base_keymap);
free(screen->stdbuf);
screen->stdbuf = NULL;
if (_cursesi_screen == screen)
_cursesi_screen = NULL;
free(screen);
}