From 9f008e347788da4799c5c12729a94c25cb6f07fb Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 29 Jun 2014 19:33:46 -0400 Subject: [PATCH] GtkStyleContext: Avoid over-eager animation cancellation When validating the style context, we are copying the animations from one StyleValues instance to another, and cancel the old ones. It turns out that sometimes the old and the new StyleValues are the same, and in this case, we end up cancelling the animations for good. One case where breakage from this was observed is that the spinners in gtk3-widget-factory stop spinning when you open and close a modal dialog on page 2. This depends a bit on the window manager; the problem can only be seen if opening the dialog causes a transition to backdrop. --- gtk/gtkstylecontext.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 1ca31bced9..fd804b291e 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -3058,12 +3058,13 @@ _gtk_style_context_validate (GtkStyleContext *context, values = style_values_lookup (context); - _gtk_css_computed_values_create_animations (values, - priv->parent ? style_values_lookup (priv->parent) : NULL, - timestamp, - GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), - priv->scale, - gtk_style_context_should_create_transitions (context) ? current : NULL); + if (values != current) + _gtk_css_computed_values_create_animations (values, + priv->parent ? style_values_lookup (priv->parent) : NULL, + timestamp, + GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), + priv->scale, + gtk_style_context_should_create_transitions (context) ? current : NULL); if (_gtk_css_computed_values_is_static (values)) change &= ~GTK_CSS_CHANGE_ANIMATE; else @@ -3075,7 +3076,8 @@ _gtk_style_context_validate (GtkStyleContext *context, changes = _gtk_css_computed_values_get_difference (values, current); /* In the case where we keep the cache, we want unanimated values */ - _gtk_css_computed_values_cancel_animations (current); + if (values != current) + _gtk_css_computed_values_cancel_animations (current); } else {