pidgin: b2242096: Some leak fixes for the gtkrc-ed nicks i...

sadrul at pidgin.im sadrul at pidgin.im
Sat Apr 5 15:30:44 EDT 2008


-----------------------------------------------------------------
Revision: b2242096222463e4ed971765af81b4531ef9b6f7
Ancestor: cfbe335ca4756596996e71e975e5cf2fe4413d8b
Author: sadrul at pidgin.im
Date: 2008-04-05T13:27:53
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b2242096222463e4ed971765af81b4531ef9b6f7

Modified files:
        pidgin/gtkconv.c

ChangeLog: 

Some leak fixes for the gtkrc-ed nicks in conversation history.

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	651b89698fe87fda60ed41879249bfc8ef593684
+++ pidgin/gtkconv.c	b1362347e19ae2b0470cfcd7fd50eb8dcde77f7e
@@ -171,7 +171,7 @@ static gboolean pidgin_conv_xy_to_right_
 		int width, int height);
 static gboolean pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y);
 
-static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) {
+static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) {
 	static GdkColor col;
 	GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml);
 	float scale;
@@ -5616,8 +5616,8 @@ pidgin_conv_write_conv(PurpleConversatio
 				if(col) {
 					g_snprintf(color, sizeof(color), "#%02X%02X%02X",
 						col->red >> 8, col->green >> 8, col->blue >> 8);
-				}
-				else {
+					gdk_color_free(col);
+				} else {
 					if (flags & PURPLE_MESSAGE_NICK)
 						strcpy(color, DEFAULT_HIGHLIGHT_COLOR);
 					else
@@ -5640,14 +5640,14 @@ pidgin_conv_write_conv(PurpleConversatio
 					if(col) {
 						g_snprintf(color, sizeof(color), "#%02X%02X%02X",
 							col->red >> 8, col->green >> 8, col->blue >> 8);
-					}
-					else {
+						gdk_color_free(col);
+					} else {
 						strcpy(color, DEFAULT_HIGHLIGHT_COLOR);
 					}
 				}
 				else if (flags & PURPLE_MESSAGE_RECV) {
 					if (type == PURPLE_CONV_TYPE_CHAT) {
-						GdkColor *col = get_nick_color(gtkconv, name);
+						const GdkColor *col = get_nick_color(gtkconv, name);
 
 						g_snprintf(color, sizeof(color), "#%02X%02X%02X",
 							   col->red >> 8, col->green >> 8, col->blue >> 8);
@@ -5657,8 +5657,8 @@ pidgin_conv_write_conv(PurpleConversatio
 						if(col) {
 							g_snprintf(color, sizeof(color), "#%02X%02X%02X",
 								col->red >> 8, col->green >> 8, col->blue >> 8);
-						}
-						else {
+							gdk_color_free(col);
+						} else {
 							strcpy(color, DEFAULT_RECV_COLOR);
 						}
 					}
@@ -5669,8 +5669,8 @@ pidgin_conv_write_conv(PurpleConversatio
 					if(col) {
 						g_snprintf(color, sizeof(color), "#%02X%02X%02X",
 							col->red >> 8, col->green >> 8, col->blue >> 8);
-					}
-					else {
+						gdk_color_free(col);
+					} else {
 						strcpy(color, DEFAULT_SEND_COLOR);
 					}
 				}


More information about the Commits mailing list