[evolution-patches] image queue clean-ups



This patch makes it safe to call image_pointer_queue_animation several
times.  This could trigger multiple timeouts under rare circumstances.

--Larry
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1782
diff -u -p -r1.1782 ChangeLog
--- ChangeLog	16 Apr 2003 17:51:55 -0000	1.1782
+++ ChangeLog	16 Apr 2003 19:08:00 -0000
@@ -1,5 +1,9 @@
 2003-04-16  Larry Ewing  <lewing ximian com>
 
+	* htmlimage.c (html_image_pointer_queue_animation): only queue the
+	animation if one hasn't already been queued.
+	(html_image_pointer_run_animation): clear the timeout source.
+
 	* htmlstyle.c (html_style_free): actually free the style.
 
 	* gtkhtml-properties.c (gtk_html_class_properties_new): don't dup
Index: htmlimage.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlimage.c,v
retrieving revision 1.182
diff -u -p -r1.182 htmlimage.c
--- htmlimage.c	8 Apr 2003 05:02:44 -0000	1.182
+++ htmlimage.c	16 Apr 2003 19:08:03 -0000
@@ -1079,12 +1079,11 @@ html_image_pointer_queue_animation (HTML
 {
 	gint delay = gdk_pixbuf_animation_iter_get_delay_time (ip->iter);
 
-	if (delay >= 0)
+	if (delay >= 0 && !ip->animation_timeout) {
 		ip->animation_timeout = g_timeout_add (delay, 
 						       (GtkFunction) html_image_pointer_run_animation, 
 						       (gpointer) ip);
-	else
-		ip->animation_timeout = 0;
+	}	
 }
 
 static gint
@@ -1094,6 +1093,7 @@ html_image_pointer_run_animation (HTMLIm
 	HTMLEngine              *engine = ip->factory->engine;
 	
 	g_return_val_if_fail (ip->factory != NULL, FALSE);
+	ip->animation_timeout = 0;
 
 	/* printf ("animation_timeout\n"); */
 	if (gdk_pixbuf_animation_iter_advance (iter, NULL)) {
@@ -1102,9 +1102,10 @@ html_image_pointer_run_animation (HTMLIm
 		for (cur = ip->interests; cur; cur = cur->next) {
 			HTMLImage           *image = cur->data;
 
-			if (image && image->animation_active)
+			if (image && image->animation_active) {
+				image->animation_active = FALSE;
 				html_engine_queue_draw (engine, HTML_OBJECT (image));
-
+			}
 		}
 	}
 		


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]