From eb7821a6503b7781b18d083a76634d03a6231db5 Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 30 Aug 2000 05:18:33 +0000 Subject: rp_current_window was being left a dangling pointer in some cases in remove_from_window_list(). BAD! --- list.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/list.c b/list.c index 2f1a145..4ffbfe9 100644 --- a/list.c +++ b/list.c @@ -78,7 +78,6 @@ find_window (Window w) return NULL; } -/* this function can rp_current_window a dangling pointer. */ void remove_from_window_list (rp_window *w) { @@ -88,6 +87,10 @@ remove_from_window_list (rp_window *w) if (w->prev != NULL) w->prev->next = w->next; if (w->next != NULL) w->next->prev = w->prev; + /* set rp_current_window to NULL, so a dangling pointer is not + left. */ + if (rp_current_window == w) rp_current_window = NULL; + free (w); #ifdef DEBUG printf ("Removed window from list.\n"); -- cgit v1.2.3