comparison pidgin/gtkblist.c @ 21400:cb9e962d4f7f

Fix iterating over accounts_signed_on_elsewhere while doing things that will cause it to change.
author Will Thompson <will.thompson@collabora.co.uk>
date Sat, 03 Nov 2007 16:32:28 +0000
parents d2bd7eae1c2c
children c1c7e28223f8
comparison
equal deleted inserted replaced
21399:d2bd7eae1c2c 21400:cb9e962d4f7f
4470 4470
4471 static void 4471 static void
4472 ignore_elsewhere_accounts(PidginBuddyList *gtkblist) 4472 ignore_elsewhere_accounts(PidginBuddyList *gtkblist)
4473 { 4473 {
4474 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); 4474 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
4475 GList *l; 4475 GList *accounts_elsewhere, *l;
4476 4476
4477 for (l = priv->accounts_signed_on_elsewhere; l != NULL; l = l->next) { 4477 /* priv->accounts_signed_on_elsewhere gets changed in
4478 * update_account_error_state, which is called when
4479 * purple_account_clear_current_error emits account-error-changed. So
4480 * let's take a copy.
4481 *
4482 * (Or maybe we could just use while(priv->accounts_elsewhere) and rely
4483 * on it being ultimately reduced to NULL? But that sounds fragile.)
4484 */
4485 accounts_elsewhere = g_list_copy(priv->accounts_signed_on_elsewhere);
4486
4487 for (l = accounts_elsewhere; l != NULL; l = l->next)
4488 {
4478 PurpleAccount *account = l->data; 4489 PurpleAccount *account = l->data;
4479 purple_account_clear_current_error(account); 4490 purple_account_clear_current_error(account);
4480 } 4491 }
4481 4492
4482 g_list_free(priv->accounts_signed_on_elsewhere); 4493 g_list_free(accounts_elsewhere);
4483 priv->accounts_signed_on_elsewhere = NULL;
4484 4494
4485 destroy_signed_on_elsewhere_minidialog(priv); 4495 destroy_signed_on_elsewhere_minidialog(priv);
4486 } 4496 }
4487 4497
4488 static GtkWidget * 4498 static GtkWidget *