changeset 28979:3e99c4eab63b

Oh, we need to make sure the buddy is on our protocol before trying to free their data.
author Mark Doliner <mark@kingant.net>
date Fri, 05 Feb 2010 02:36:30 +0000
parents 746bf7d8b34e
children 1386a0e22ac7
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Fri Feb 05 02:19:22 2010 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Fri Feb 05 02:36:30 2010 +0000
@@ -2254,9 +2254,16 @@
 static void
 msim_close(PurpleConnection *gc)
 {
+	PurpleAccount *account;
 	GSList *buddies;
 	MsimSession *session;
 
+	if (gc == NULL) {
+		return;
+	}
+
+	account = purple_connection_get_account(gc);
+
 	/*
 	 * Free our protocol-specific buddy data.  It almost seems like libpurple
 	 * should call our buddy_free prpl callback so that we don't need to do
@@ -2264,14 +2271,14 @@
 	 */
 	buddies = purple_blist_get_buddies();
 	while (buddies != NULL) {
-		msim_buddy_free(buddies->data);
+		PurpleBuddy *buddy = buddies->data;
+
+		if (purple_buddy_get_account(buddy) == account)
+			msim_buddy_free(buddy);
+
 		buddies = g_slist_delete_link(buddies, buddies);
 	}
 
-	if (gc == NULL) {
-		return;
-	}
-
 	session = (MsimSession *)gc->proto_data;
 	if (session == NULL)
 		return;