im.pidgin.cpw.resiak.disconnectreason: 5a11e9597e1b38a5e5ff1f2cce678aa5e722a797

resiak at soc.pidgin.im resiak at soc.pidgin.im
Sat Nov 3 13:11:43 EDT 2007


-----------------------------------------------------------------
Revision: 5a11e9597e1b38a5e5ff1f2cce678aa5e722a797
Ancestor: 009ea1fb8f4b70b41d13daad8cfe478887558cbd
Author: resiak at soc.pidgin.im
Date: 2007-11-03T16:32:28
Branch: im.pidgin.cpw.resiak.disconnectreason

Modified files:
        pidgin/gtkblist.c

ChangeLog: 

Fix iterating over accounts_signed_on_elsewhere while doing things that will
cause it to change.

-------------- next part --------------
============================================================
--- pidgin/gtkblist.c	ed774ec8a919b4de5ecf2949cc84f8aac7d9b9ce
+++ pidgin/gtkblist.c	9807d7b9cf4e4aa5aa20249dcb438972b12abd93
@@ -4472,15 +4472,25 @@ ignore_elsewhere_accounts(PidginBuddyLis
 ignore_elsewhere_accounts(PidginBuddyList *gtkblist)
 {
 	PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
-	GList *l;
+	GList *accounts_elsewhere, *l;
 
-	for (l = priv->accounts_signed_on_elsewhere; l != NULL; l = l->next) {
+	/* priv->accounts_signed_on_elsewhere gets changed in
+	 * update_account_error_state, which is called when
+	 * purple_account_clear_current_error emits account-error-changed. So
+	 * let's take a copy.
+	 *
+	 * (Or maybe we could just use while(priv->accounts_elsewhere) and rely
+	 * on it being ultimately reduced to NULL?  But that sounds fragile.)
+	 */
+	accounts_elsewhere = g_list_copy(priv->accounts_signed_on_elsewhere);
+
+	for (l = accounts_elsewhere; l != NULL; l = l->next)
+	{
 		PurpleAccount *account = l->data;
 		purple_account_clear_current_error(account);
 	}
 
-	g_list_free(priv->accounts_signed_on_elsewhere);
-	priv->accounts_signed_on_elsewhere = NULL;
+	g_list_free(accounts_elsewhere);
 
 	destroy_signed_on_elsewhere_minidialog(priv);
 }


More information about the Commits mailing list