X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_newwin.c;h=564c07fbb1f9e32f85e743880147e992547036e9;hp=a6c64beaaf4a1c0efc45fde3cb30164e8c9a4568;hb=76a479337308b4b5e749fa8c38b7b7f482998c5b;hpb=d1a026123ac051716cdc16278345c1fb5c843b79 diff --git a/ncurses/base/lib_newwin.c b/ncurses/base/lib_newwin.c index a6c64bea..564c07fb 100644 --- a/ncurses/base/lib_newwin.c +++ b/ncurses/base/lib_newwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -43,7 +43,7 @@ #include #include -MODULE_ID("$Id: lib_newwin.c,v 1.71 2011/05/28 21:32:51 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.72 2016/05/28 23:11:26 tom Exp $") #define window_is(name) ((sp)->_##name == win) @@ -91,8 +91,6 @@ remove_window_from_screen(WINDOW *win) NCURSES_EXPORT(int) _nc_freewin(WINDOW *win) { - WINDOWLIST *p, *q; - int i; int result = ERR; #ifdef USE_SP_WINDOWLIST SCREEN *sp = _nc_screen_of(win); /* pretend this is parameter */ @@ -101,9 +99,13 @@ _nc_freewin(WINDOW *win) T((T_CALLED("_nc_freewin(%p)"), (void *) win)); if (win != 0) { + if (_nc_nonsp_try_global(curses) == 0) { + WINDOWLIST *p, *q; + q = 0; for (each_window(SP_PARM, p)) { + if (&(p->win) == win) { remove_window_from_screen(win); if (q == 0) @@ -112,6 +114,8 @@ _nc_freewin(WINDOW *win) q->next = p->next; if (!(win->_flags & _SUBWIN)) { + int i; + for (i = 0; i <= win->_maxy; i++) FreeIfNeeded(win->_line[i].text); }