changeset 22562:e59156cf8752

Fix animated icons that have been right-clicked causing crashes when the imhtml is destroyed. Fixes #5217.
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 26 Mar 2008 02:37:45 +0000
parents 387024e316d1
children 6a1818a9d939
files pidgin/gtkimhtml.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Wed Mar 26 00:18:15 2008 +0000
+++ b/pidgin/gtkimhtml.c	Wed Mar 26 02:37:45 2008 +0000
@@ -3296,7 +3296,7 @@
 
 GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *anim, const gchar *filename, int id)
 {
-	GtkIMHtmlImage *im_image = g_malloc(sizeof(GtkIMHtmlAnimation));
+	GtkIMHtmlImage *im_image = (GtkIMHtmlImage *) g_new0(GtkIMHtmlAnimation, 1);
 
 	GTK_IMHTML_SCALABLE(im_image)->scale = gtk_imhtml_image_scale;
 	GTK_IMHTML_SCALABLE(im_image)->add_to = gtk_imhtml_image_add_to;
@@ -3304,10 +3304,8 @@
 
 	GTK_IMHTML_ANIMATION(im_image)->anim = anim;
 	if (gdk_pixbuf_animation_is_static_image(anim)) {
-		GTK_IMHTML_ANIMATION(im_image)->iter = NULL;
 		im_image->pixbuf = gdk_pixbuf_animation_get_static_image(anim);
 		g_object_ref(im_image->pixbuf);
-		GTK_IMHTML_ANIMATION(im_image)->timer = 0;
 	} else {
 		int delay;
 		GdkPixbuf *pb;
@@ -3320,10 +3318,8 @@
 	im_image->image = GTK_IMAGE(gtk_image_new_from_pixbuf(im_image->pixbuf));
 	im_image->width = gdk_pixbuf_animation_get_width(anim);
 	im_image->height = gdk_pixbuf_animation_get_height(anim);
-	im_image->mark = NULL;
 	im_image->filename = g_strdup(filename);
 	im_image->id = id;
-	im_image->filesel = NULL;
 
 	g_object_ref(anim);
 
@@ -3619,7 +3615,7 @@
 
 	image = gtk_imhtml_animation_new(anim, smiley->smile, 0);
 	ret = gtk_imhtml_image_clicked(w, event, (GtkIMHtmlImage*)image);
-	g_object_set_data_full(G_OBJECT(w), "image-data", image, (GDestroyNotify)gtk_imhtml_image_free);
+	g_object_set_data_full(G_OBJECT(w), "image-data", image, (GDestroyNotify)gtk_imhtml_animation_free);
 	return ret;
 }