changeset 3256:a7c241854218

[gaim-migrate @ 3274] Fixed an applet memory leak. Serves me right for not reading the documentation. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 16 May 2002 22:46:42 +0000
parents bea080f7f5c7
children 4c28751180f9
files ChangeLog src/applet.c
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 16 02:13:45 2002 +0000
+++ b/ChangeLog	Thu May 16 22:46:42 2002 +0000
@@ -5,7 +5,8 @@
 	* Squashed a bug in buddy right-click menu handling
 	  that crashed Gaim.  In the process: found and
 	  eliminated some memory leaks.
-	
+	* Fixed a significant applet leak
+
 version 0.58 (05/13/2002):
 	* Bulgarian translation added (Thanks, Igel Itzo)
 	* Taiwanese translation added (Thanks, Paladin Liu)
--- a/src/applet.c	Thu May 16 02:13:45 2002 +0000
+++ b/src/applet.c	Thu May 16 22:46:42 2002 +0000
@@ -72,18 +72,17 @@
 			gtk_widget_get_visual(applet)->depth); 
 	gc = gdk_gc_new(cache);
 	gdk_gc_copy(gc, applet->style->bg_gc[GTK_WIDGET_STATE(applet)]);
-
 	path = gnome_pixmap_file(name);
-	if (path)
+	if (path) {
 		scale = gdk_pixbuf_new_from_file(path);
-	g_free(path);
+		g_free(path);
+	}
 	if (!scale)
 		return NULL;
 	pb = gdk_pixbuf_scale_simple(scale, sizehint, sizehint, GDK_INTERP_HYPER);
 	gdk_pixbuf_unref(scale);
 
-	dst = g_new0(guchar, sizehint*sizehint*3);
-	applet_widget_get_rgb_bg(applet, &dst, &w, &h, &rowstride);
+	applet_widget_get_rgb_bg(APPLET_WIDGET(applet), &dst, &w, &h, &rowstride);
 
 	art_affine_identity(affine);
 	art_rgb_rgba_affine(dst, 0, 0, w, h, rowstride,
@@ -335,8 +334,6 @@
 	applet = applet_widget_new("gaim_applet");
 	if (!applet)
 		g_error(_("Can't create Gaim applet!"));
-	applet_widget_send_draw(applet, TRUE);
-	gtk_signal_connect(GTK_OBJECT(applet), "do-draw", GTK_SIGNAL_FUNC(update_applet), NULL);
 	gtk_widget_set_events(applet, gtk_widget_get_events(applet) | GDK_BUTTON_PRESS_MASK);
 	gtk_widget_realize(applet);
 
@@ -368,6 +365,8 @@
 			   GTK_SIGNAL_FUNC(applet_change_pixel_size), NULL);
 #endif
 
+	applet_widget_send_draw(applet, TRUE);
+	gtk_signal_connect(GTK_OBJECT(applet), "do-draw", GTK_SIGNAL_FUNC(update_applet), NULL);
 	gtk_widget_show(icon);
 	gtk_widget_show(applet);
 	return 0;