****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 1996,1997 *
+ * Author: Thomas E. Dickey 1996-on *
****************************************************************************/
#include <curses.priv.h>
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$Id: lib_freeall.c,v 1.42 2007/02/03 18:44:28 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.45 2007/12/22 23:29:37 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
}
#endif
if (SP != 0) {
+ _nc_lock_global(windowlist);
+
while (_nc_windows != 0) {
+ bool deleted = FALSE;
+
/* Delete only windows that're not a parent */
for (p = _nc_windows; p != 0; p = p->next) {
bool found = FALSE;
}
if (!found) {
- delwin(&(p->win));
+ if (delwin(&(p->win)) != ERR)
+ deleted = TRUE;
break;
}
}
+
+ /*
+ * Don't continue to loop if the list is trashed.
+ */
+ if (!deleted)
+ break;
}
delscreen(SP);
+ _nc_unlock_global(windowlist);
}
- del_curterm(cur_term);
+ if (cur_term != 0)
+ del_curterm(cur_term);
#if USE_WIDEC_SUPPORT
FreeIfNeeded(_nc_wacs);
(void) _nc_trace_buf(-1, 0);
#endif
+#if BROKEN_LINKER || USE_REENTRANT
+ FreeIfNeeded(_nc_prescreen.real_acs_map);
+#endif
+
_nc_leaks_tinfo();
#if HAVE_LIBDBMALLOC