changeset 4647:ba87412b1a57

[gaim-migrate @ 4957] the black art of iterating through a list you're deleting from committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 04 Mar 2003 08:25:50 +0000
parents 440d3d870b84
children 4bb99cdfd837
files src/conversation.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Mar 04 06:40:20 2003 +0000
+++ b/src/conversation.c	Tue Mar 04 08:25:50 2003 +0000
@@ -475,13 +475,12 @@
 	 */
 	if (gaim_window_get_conversation_count(win) > 0) {
 
-		for (node = g_list_first(gaim_window_get_conversations(win));
-			 node != NULL;
-			 node = g_list_next(node))
+		node = g_list_first(gaim_window_get_conversations(win));
+		while(node != NULL)
 		{
-			struct gaim_conversation *conv;
-
-			conv = (struct gaim_conversation *)node->data;
+			struct gaim_conversation *conv = node->data;
+
+			node = g_list_next(node);
 
 			gaim_conversation_destroy(conv);
 		}