# HG changeset patch # User Paul Aurich # Date 1308627290 0 # Node ID f7c3aac5b22bf91ede8c07d9bfb8cb2da69f9427 # Parent 84ac2406bb10dd3a3a32bc03488fb32c4cb7b407 conversation: Use a copy of the name and clear hash after emitting "left" signals diff -r 84ac2406bb10 -r f7c3aac5b22b libpurple/conversation.c --- a/libpurple/conversation.c Tue Jun 21 01:58:17 2011 +0000 +++ b/libpurple/conversation.c Tue Jun 21 03:34:50 2011 +0000 @@ -413,7 +413,7 @@ conv->u.chat = g_new0(PurpleConvChat, 1); conv->u.chat->conv = conv; conv->u.chat->users = g_hash_table_new_full(_purple_conversation_user_hash, - _purple_conversation_user_equal, NULL, NULL); + _purple_conversation_user_equal, g_free, NULL); PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleConvChat); chats = g_list_prepend(chats, conv); @@ -1702,7 +1702,7 @@ cbuddy->buddy = purple_find_buddy(conv->account, user) != NULL; chat->in_room = g_list_prepend(chat->in_room, cbuddy); - g_hash_table_replace(chat->users, cbuddy->name, cbuddy); + g_hash_table_replace(chat->users, g_strdup(cbuddy->name), cbuddy); cbuddies = g_list_prepend(cbuddies, cbuddy); @@ -1796,7 +1796,7 @@ cb->buddy = purple_find_buddy(conv->account, new_user) != NULL; chat->in_room = g_list_prepend(chat->in_room, cb); - g_hash_table_replace(chat->users, cb->name, cb); + g_hash_table_replace(chat->users, g_strdup(cb->name), cb); if (ops != NULL && ops->chat_rename_user != NULL) ops->chat_rename_user(conv, old_user, new_user, new_alias); @@ -1967,8 +1967,6 @@ g_list_free(names); } - g_hash_table_remove_all(chat->users); - for (l = users; l; l = l->next) { PurpleConvChatBuddy *cb = l->data; @@ -1981,6 +1979,9 @@ purple_conv_chat_cb_destroy(cb); } + g_hash_table_remove_all(chat->users); + chat->users = NULL; + g_list_free(users); chat->in_room = NULL; }