# HG changeset patch # User Sadrul Habib Chowdhury # Date 1207402073 0 # Node ID aff371178b6ffc8656733e2f99fd064edc913265 # Parent 98775a5b4817c68d403b0d2700bebf9cbb7ecac3 Some leak fixes for the gtkrc-ed nicks in conversation history. diff -r 98775a5b4817 -r aff371178b6f pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sat Apr 05 12:59:31 2008 +0000 +++ b/pidgin/gtkconv.c Sat Apr 05 13:27:53 2008 +0000 @@ -171,7 +171,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); } }