From 27fcabbc1965e9d7836f6e196ed2019a215bbe91 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 15 Jul 2001 18:21:44 +0000 Subject: Previous foreach fixes to /FOREACH WINDOW too. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1632 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/window-commands.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 99af8e77..c158ba39 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -517,16 +517,20 @@ static void cmd_layout(const char *data, SERVER_REC *server, WI_ITEM_REC *item) static void cmd_foreach_window(const char *data) { WINDOW_REC *old; - GSList *tmp; + GSList *list; old = active_win; - for (tmp = windows; tmp != NULL; tmp = tmp->next) { - WINDOW_REC *rec = tmp->data; - active_win = rec; + list = g_slist_copy(windows); + while (list != NULL) { + WINDOW_REC *rec = list->data; + + active_win = rec; signal_emit("send command", 3, data, rec->active_server, rec->active); + list = g_slist_remove(list, list->data); } + active_win = old; } -- cgit v1.2.3