pidgin: 715e0c80: Don't double-free the color hash table w...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Jul 8 13:25:36 EDT 2009


-----------------------------------------------------------------
Revision: 715e0c80b3edebfaea1d18534006de8e95ae453e
Ancestor: 292ad961a7d320b8c8e875a3ce990e68dd3d1f49
Author: markdoliner at pidgin.im
Date: 2009-07-08T17:20:00
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/715e0c80b3edebfaea1d18534006de8e95ae453e

Modified files:
        libpurple/protocols/yahoo/util.c

ChangeLog: 

Don't double-free the color hash table when deinitializing both prpl-yahoo
and prpl-yahoojp.  This caused a crash-at-exit when you had signed onto
both types of accounts during your session.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c	60b9c5b66765c21b91387e8c49a75ec59bda6692
+++ libpurple/protocols/yahoo/util.c	a0c6ca2fc240be09a60a76978ab8c09d2145cfba
@@ -214,8 +214,12 @@ void yahoo_init_colorht()
 
 void yahoo_init_colorht()
 {
+	if (ht != NULL)
+		/* Hash table has already been initialized */
+		return;
+
 	ht = g_hash_table_new(g_str_hash, g_str_equal);
-/* the numbers in comments are what gyach uses, but i think they're incorrect */
+	/* the numbers in comments are what gyach uses, but i think they're incorrect */
 	g_hash_table_insert(ht, "30", "<FONT COLOR=\"#000000\">"); /* black */
 	g_hash_table_insert(ht, "31", "<FONT COLOR=\"#0000FF\">"); /* blue */
 	g_hash_table_insert(ht, "32", "<FONT COLOR=\"#008080\">"); /* cyan */      /* 00b2b2 */
@@ -284,7 +288,12 @@ void yahoo_dest_colorht()
 
 void yahoo_dest_colorht()
 {
+	if (ht == NULL)
+		/* Hash table has already been destroyed */
+		return;
+
 	g_hash_table_destroy(ht);
+	ht = NULL;
 }
 
 static int point_to_html(int x)


More information about the Commits mailing list