changeset 23107:ebf8c74960bc

merge of '88d15a78416cbab803d3b60b47292506e763d5d0' and '8cbfaca9b4aa3bfb454400bbaf91faa1bddbdc8c'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 30 Apr 2008 16:50:06 +0000
parents 568a0957e835 (diff) 3fee7e01e51c (current diff)
children 53bf3c21b79d
files
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/chat.c	Wed Apr 30 11:28:23 2008 +0000
+++ b/libpurple/protocols/jabber/chat.c	Wed Apr 30 16:50:06 2008 +0000
@@ -198,6 +198,12 @@
 	return chat_name;
 }
 
+static void insert_in_hash_table(gpointer key, gpointer value, gpointer user_data)
+{
+	GHashTable *hash_table = (GHashTable *)user_data;
+	g_hash_table_insert(hash_table, key, value);
+}
+
 void jabber_chat_join(PurpleConnection *gc, GHashTable *data)
 {
 	JabberChat *chat;
@@ -259,8 +265,11 @@
 	chat->server = g_strdup(server);
 	chat->handle = g_strdup(handle);
 
-	chat->components = g_hash_table_ref(data);
-										
+	/* Copy the data hash table to chat->components */
+	chat->components = g_hash_table_new_full(g_str_hash, g_str_equal,
+			g_free, g_free);
+	g_hash_table_foreach(data, insert_in_hash_table, chat->components);
+
 	chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
 			(GDestroyNotify)jabber_chat_member_free);
 
@@ -321,7 +330,7 @@
 	g_free(chat->server);
 	g_free(chat->handle);
 	g_hash_table_destroy(chat->members);
-	g_hash_table_unref(chat->components);
+	g_hash_table_destroy(chat->components);
 	g_free(chat);
 }