Mercurial > pidgin.yaz
changeset 13969:8934a27fed4b
[gaim-migrate @ 16527]
Sadrul sent me this patch to look over and then commit. It fixes a PRPL leak in Yahoo's chat and fixes a few other memory leaks that were
mostly my fault.
committer: Tailor Script <tailor@pidgin.im>
author | Aaron Sheldon <aaronsheldon> |
---|---|
date | Thu, 20 Jul 2006 12:53:46 +0000 |
parents | 6fc412e59214 |
children | 4a2e9c494bed |
files | src/conversation.c src/gtkconv.c src/protocols/yahoo/yahoochat.c |
diffstat | 3 files changed, 14 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/conversation.c Thu Jul 20 08:11:54 2006 +0000 +++ b/src/conversation.c Thu Jul 20 12:53:46 2006 +0000 @@ -1485,7 +1485,7 @@ { GaimConversation *conv; GaimConversationUiOps *ops; - GaimConvChatBuddy *cb; + GaimConvChatBuddy *cbuddy; GaimConnection *gc; GaimPluginProtocolInfo *prpl_info; GList *ul, *fl; @@ -1508,12 +1508,9 @@ const char *user = (const char *)ul->data; const char *alias = user; gboolean quiet; - GaimConvChatBuddy *cbuddy; - GaimConvChatBuddyFlags flags = GPOINTER_TO_INT(fl->data); + GaimConvChatBuddyFlags flag = GPOINTER_TO_INT(fl->data); const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); - cbuddy = gaim_conv_chat_cb_new(user, NULL, GPOINTER_TO_INT(fl->data)); - if (!strcmp(chat->nick, gaim_normalize(conv->account, user))) { const char *alias2 = gaim_account_get_alias(conv->account); if (alias2 != NULL) @@ -1531,17 +1528,14 @@ } quiet = GPOINTER_TO_INT(gaim_signal_emit_return_1(gaim_conversations_get_handle(), - "chat-buddy-joining", conv, user, flags)) | + "chat-buddy-joining", conv, user, flag)) | gaim_conv_chat_is_user_ignored(chat, user); - cb = gaim_conv_chat_cb_new(user, NULL, flags); + cbuddy = gaim_conv_chat_cb_new(user, alias, flag); /* This seems dumb. Why should we set users thousands of times? */ gaim_conv_chat_set_users(chat, - g_list_prepend(gaim_conv_chat_get_users(chat), cb)); - - cbuddy->alias = strdup(alias); /* Should I be doing a strdup? */ - cbuddy->alias_key = g_utf8_collate_key(alias, strlen(alias)); - cbuddy->buddy = (gaim_find_buddy(conv->account, cbuddy->name) != NULL); + g_list_prepend(gaim_conv_chat_get_users(chat), cbuddy)); + cbuddies = g_list_prepend(cbuddies, cbuddy); if (!quiet && new_arrivals) { @@ -1563,7 +1557,7 @@ } gaim_signal_emit(gaim_conversations_get_handle(), - "chat-buddy-joined", conv, user, flags, new_arrivals); + "chat-buddy-joined", conv, user, flag, new_arrivals); ul = ul->next; fl = fl->next; if (extra_msgs != NULL) @@ -1575,6 +1569,7 @@ if (ops != NULL && ops->chat_add_users != NULL) ops->chat_add_users(conv, cbuddies, new_arrivals); + g_list_free(cbuddies); } void
--- a/src/gtkconv.c Thu Jul 20 08:11:54 2006 +0000 +++ b/src/gtkconv.c Thu Jul 20 12:53:46 2006 +0000 @@ -3398,6 +3398,7 @@ if (pixbuf) g_object_unref(pixbuf); + g_free(alias_key); } static void @@ -3707,7 +3708,7 @@ if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) { const char *alias = name; - char *alias_key = g_utf8_collate_key(alias, strlen(alias)); + char *alias_key = NULL; GaimBuddy *buddy2; if (strcmp(chat->nick, gaim_normalize(conv->account, name))) { @@ -3715,13 +3716,15 @@ if ((buddy2 = gaim_find_buddy(conv->account, name)) != NULL) { alias = gaim_buddy_get_contact_alias(buddy2); - alias_key = g_utf8_collate_key(alias, strlen(alias)); } + alias_key = g_utf8_collate_key(alias, strlen(alias)); + gtk_list_store_set(GTK_LIST_STORE(model), &iter, CHAT_USERS_ALIAS_COLUMN, alias, CHAT_USERS_ALIAS_KEY_COLUMN, alias_key, -1); + g_free(alias_key); } g_free(name); break;
--- a/src/protocols/yahoo/yahoochat.c Thu Jul 20 08:11:54 2006 +0000 +++ b/src/protocols/yahoo/yahoochat.c Thu Jul 20 12:53:46 2006 +0000 @@ -460,6 +460,7 @@ yd->chat_name = g_strdup(room); gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members, NULL, flags, FALSE); } + g_list_free(flags); } else if (c) { yahoo_chat_add_users(GAIM_CONV_CHAT(c), members); }