pidgin.next.minor: 88d15a78: g_hash_table_ref() / g_hash_table_unref(..

evands at pidgin.im evands at pidgin.im
Wed Apr 30 10:10:41 EDT 2008


-----------------------------------------------------------------
Revision: 88d15a78416cbab803d3b60b47292506e763d5d0
Ancestor: 6b848e03c7f6c7c392579517011deded648dedec
Author: evands at pidgin.im
Date: 2008-04-30T14:06:03
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/88d15a78416cbab803d3b60b47292506e763d5d0

Modified files:
        libpurple/protocols/jabber/chat.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/chat.c	5ff5bdb5292802f09d911922a60617e3670f3f84
+++ libpurple/protocols/jabber/chat.c	8ca8027d67f3c9c00cb203e44a0c9ac9baef086d
@@ -198,6 +198,12 @@ char *jabber_get_chat_name(GHashTable *d
 	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 @@ void jabber_chat_join(PurpleConnection *
 	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 @@ void jabber_chat_free(JabberChat *chat)
 	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);
 }
 


More information about the Commits mailing list