diff -r 4e5c87f9d62c -r f75a71fa6e19 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Fri Sep 28 15:13:49 2007 +0000 +++ b/pidgin/gtkimhtml.c Mon Oct 01 17:01:20 2007 +0000 @@ -3210,25 +3210,24 @@ im_image = data; /* Update the pointer to this GdkPixbuf frame of the animation */ - if (gdk_pixbuf_animation_iter_advance(GTK_IMHTML_ANIMATION(im_image)->iter, NULL)) { - GdkPixbuf *pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); - g_object_unref(G_OBJECT(im_image->pixbuf)); - im_image->pixbuf = gdk_pixbuf_copy(pb); - - /* Update the displayed GtkImage */ - width = gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)); - height = gdk_pixbuf_get_height(gtk_image_get_pixbuf(im_image->image)); - if (width > 0 && height > 0) - { - /* Need to scale the new frame to the same size as the old frame */ - GdkPixbuf *tmp; - tmp = gdk_pixbuf_scale_simple(im_image->pixbuf, width, height, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(im_image->image, tmp); - g_object_unref(G_OBJECT(tmp)); - } else { - /* Display at full-size */ - gtk_image_set_from_pixbuf(im_image->image, im_image->pixbuf); - } + g_object_unref(G_OBJECT(im_image->pixbuf)); + gdk_pixbuf_animation_iter_advance(GTK_IMHTML_ANIMATION(im_image)->iter, NULL); + im_image->pixbuf = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); + g_object_ref(G_OBJECT(im_image->pixbuf)); + + /* Update the displayed GtkImage */ + width = gdk_pixbuf_get_width(gtk_image_get_pixbuf(im_image->image)); + height = gdk_pixbuf_get_height(gtk_image_get_pixbuf(im_image->image)); + if (width > 0 && height > 0) + { + /* Need to scale the new frame to the same size as the old frame */ + GdkPixbuf *tmp; + tmp = gdk_pixbuf_scale_simple(im_image->pixbuf, width, height, GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(im_image->image, tmp); + g_object_unref(G_OBJECT(tmp)); + } else { + /* Display at full-size */ + gtk_image_set_from_pixbuf(im_image->image, im_image->pixbuf); } delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); @@ -3249,14 +3248,11 @@ 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; GTK_IMHTML_ANIMATION(im_image)->iter = gdk_pixbuf_animation_get_iter(anim, NULL); - pb = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); - im_image->pixbuf = gdk_pixbuf_copy(pb); + im_image->pixbuf = gdk_pixbuf_animation_iter_get_pixbuf(GTK_IMHTML_ANIMATION(im_image)->iter); delay = MIN(gdk_pixbuf_animation_iter_get_delay_time(GTK_IMHTML_ANIMATION(im_image)->iter), 100); GTK_IMHTML_ANIMATION(im_image)->timer = g_timeout_add(delay, animate_image_cb, im_image); } @@ -3269,6 +3265,7 @@ im_image->filesel = NULL; g_object_ref(anim); + g_object_ref(im_image->pixbuf); return GTK_IMHTML_SCALABLE(im_image); } @@ -4608,15 +4605,10 @@ if (imhtml->num_animations == 20) { GtkImage *image = GTK_IMAGE(g_queue_pop_head(imhtml->animations)); GdkPixbufAnimation *anim = gtk_image_get_animation(image); - g_signal_handlers_disconnect_matched(G_OBJECT(image), G_SIGNAL_MATCH_FUNC, - 0, 0, NULL, G_CALLBACK(animated_smiley_destroy_cb), NULL); if (anim) { GdkPixbuf *pb = gdk_pixbuf_animation_get_static_image(anim); - if (pb != NULL) { - GdkPixbuf *copy = gdk_pixbuf_copy(pb); - gtk_image_set_from_pixbuf(image, copy); - g_object_unref(G_OBJECT(copy)); - } + gtk_image_set_from_pixbuf(image, pb); + g_object_unref(G_OBJECT(pb)); } } else { imhtml->num_animations++;