summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2000-08-30 05:18:33 +0000
committersabetts <sabetts>2000-08-30 05:18:33 +0000
commiteb7821a6503b7781b18d083a76634d03a6231db5 (patch)
treebe494d5f9b7d20ad843c0994726cd58fb1838fde
parenta334f42803a72d2bcc2f64b7f734df8b5ece165e (diff)
downloadratpoison-eb7821a6503b7781b18d083a76634d03a6231db5.zip
rp_current_window was being left a dangling pointer in some cases in
remove_from_window_list(). BAD!
-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");