changeset 23106:568a0957e835

g_hash_table_ref() / g_hash_table_unref() were added in too recent a glib version per Mark. Copy data to chat->components rather than using those.
author Evan Schoenberg <evan.s@dreskin.net>
date Wed, 30 Apr 2008 14:06:03 +0000
parents 591ef3693345
children ebf8c74960bc
files libpurple/protocols/jabber/chat.c
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/chat.c	Wed Apr 30 06:29:16 2008 +0000
+++ b/libpurple/protocols/jabber/chat.c	Wed Apr 30 14:06:03 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);
 }