changeset 22613:aff371178b6f

Some leak fixes for the gtkrc-ed nicks in conversation history.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 05 Apr 2008 13:27:53 +0000
parents 98775a5b4817
children d2a5d298de66
files pidgin/gtkconv.c
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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);
 					}
 				}