# HG changeset patch # User Nathan Walp # Date 1047801071 0 # Node ID 7fd8a82a7c36fed8f81e977c2d70b41c12387960 # Parent 0c95a373124458ca4224d35b6e5c0abc5c6f1b58 [gaim-migrate @ 5119] read the comment in the code and know my rage. committer: Tailor Script diff -r 0c95a3731244 -r 7fd8a82a7c36 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sun Mar 16 06:43:27 2003 +0000 +++ b/src/protocols/oscar/oscar.c Sun Mar 16 07:51:11 2003 +0000 @@ -2173,7 +2173,7 @@ } else if (args->reqclass & AIM_CAPS_GETFILE) { } else if (args->reqclass & AIM_CAPS_VOICE) { } else if (args->reqclass & AIM_CAPS_BUDDYICON) { - set_icon_data(gc, normalize(userinfo->sn), args->info.icon.icon, + set_icon_data(gc, userinfo->sn, args->info.icon.icon, args->info.icon.length); } else if (args->reqclass & AIM_CAPS_IMIMAGE) { struct ask_direct *d = g_new0(struct ask_direct, 1); diff -r 0c95a3731244 -r 7fd8a82a7c36 src/prpl.c --- a/src/prpl.c Sun Mar 16 06:43:27 2003 +0000 +++ b/src/prpl.c Sun Mar 16 07:51:11 2003 +0000 @@ -560,10 +560,21 @@ GList *l; struct icon_data *id; struct buddy *b; + /* i'm going to vent here a little bit about normalize(). normalize() + * uses a static buffer, so when we call functions that use normalize() from + * functions that use normalize(), whose parameters are the result of running + * normalize(), bad things happen. To prevent some of this, we're going + * to make a copy of what we get from normalize(), so we know nothing else + * touches it, and buddy icons don't go to the wrong person. Some day I + * will kill normalize(), and dance on its grave. That will be a very happy + * day for everyone. + * --ndw + */ + char *realwho = g_strdup(normalize(who)); tmp.gc = gc; - tmp.who = normalize(who); + tmp.who = realwho; tmp.data=NULL; - tmp.len = 0; + tmp.len = 0; l = g_list_find_custom(icons, &tmp, find_icon_data); id = l ? l->data : NULL; @@ -573,29 +584,31 @@ icons = g_list_remove(icons, id); g_free(id->who); g_free(id); + g_free(realwho); return; } } else if (data) { id = g_new0(struct icon_data, 1); icons = g_list_append(icons, id); id->gc = gc; - id->who = g_strdup(normalize(who)); + id->who = g_strdup(realwho); } else { + g_free(realwho); return; } - debug_printf("Got icon for %s (length %d)\n", who, len); + debug_printf("Got icon for %s (length %d)\n", realwho, len); id->data = g_memdup(data, len); id->len = len; /* Update the buddy icon for this user. */ - conv = gaim_find_conversation(who); + conv = gaim_find_conversation(realwho); /* XXX Buddy Icon should probalby be part of struct buddy instead of this weird global * linked list stuff. */ - if ((b = gaim_find_buddy(gc->account, who)) != NULL) { + if ((b = gaim_find_buddy(gc->account, realwho)) != NULL) { char *random = g_strdup_printf("%x", g_random_int()); char *filename = g_build_filename(gaim_user_dir(), "icons", random, NULL); @@ -631,6 +644,8 @@ if (conv != NULL && gaim_conversation_get_gc(conv) == gc) gaim_gtkconv_update_buddy_icon(conv); + + g_free(realwho); } void remove_icon_data(struct gaim_connection *gc)