summaryrefslogtreecommitdiff
path: root/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'list.c')
-rw-r--r--list.c5
1 files changed, 4 insertions, 1 deletions
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");