diff options
-rw-r--r-- | list.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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"); |