Commit 3bc0672f authored by Øyvind Kolås's avatar Øyvind Kolås

animator: handle no initial key

Fixing the crasher reported in bug #1995.
parent d2db5127
......@@ -457,36 +457,47 @@ animation_animator_ensure_animator (ClutterAnimator *animator,
initial = g_list_find_custom (key_animator->current->next,
key,
sort_actor_prop_func);
g_assert (initial != NULL);
initial_key = initial->data;
if (initial)
{
initial_key = initial->data;
clutter_interval_set_initial_value (key_animator->interval,
&initial_key->value);
key_animator->current = initial;
key_animator->start = initial_key->progress;
clutter_interval_set_initial_value (key_animator->interval,
&initial_key->value);
key_animator->current = initial;
key_animator->start = initial_key->progress;
next = g_list_find_custom (initial->next,
key,
sort_actor_prop_func);
if (next)
{
next_key = next->data;
next = g_list_find_custom (initial->next,
key,
sort_actor_prop_func);
if (next)
{
next_key = next->data;
key_animator->end = next_key->progress;
}
else
{
next_key = initial_key;
key_animator->end = next_key->progress;
}
else
{
next_key = initial_key;
key_animator->end = 1.0;
}
key_animator->end = 1.0;
}
clutter_interval_set_final_value (key_animator->interval,
&next_key->value);
clutter_interval_set_final_value (key_animator->interval,
&next_key->value);
if ((clutter_alpha_get_mode (key_animator->alpha) != next_key->mode))
clutter_alpha_set_mode (key_animator->alpha, next_key->mode);
if ((clutter_alpha_get_mode (key_animator->alpha) != next_key->mode))
clutter_alpha_set_mode (key_animator->alpha, next_key->mode);
}
else /* no relevant interval */
{
ClutterAnimatorKey *current_key = key_animator->current->data;
clutter_interval_set_initial_value (key_animator->interval,
&current_key->value);
clutter_interval_set_final_value (key_animator->interval,
&current_key->value);
break;
}
}
}
else if (progress < key_animator->start)
......@@ -500,33 +511,44 @@ animation_animator_ensure_animator (ClutterAnimator *animator,
initial = list_find_custom_reverse (key_animator->current->prev,
key,
sort_actor_prop_func);
g_assert (initial != NULL);
initial_key = initial->data;
if (initial)
{
initial_key = initial->data;
clutter_interval_set_initial_value (key_animator->interval,
&initial_key->value);
key_animator->current = initial;
key_animator->end = key_animator->start;
key_animator->start = initial_key->progress;
clutter_interval_set_initial_value (key_animator->interval,
&initial_key->value);
key_animator->current = initial;
key_animator->end = key_animator->start;
key_animator->start = initial_key->progress;
if (old)
{
next_key = old->data;
if (old)
{
next_key = old->data;
key_animator->end = next_key->progress;
key_animator->end = next_key->progress;
}
else
{
next_key = initial_key;
key_animator->end = 1.0;
}
clutter_interval_set_final_value (key_animator->interval,
&next_key->value);
if ((clutter_alpha_get_mode (key_animator->alpha) != next_key->mode))
clutter_alpha_set_mode (key_animator->alpha, next_key->mode);
}
else
else /* no relevant interval */
{
next_key = initial_key;
key_animator->end = 1.0;
ClutterAnimatorKey *current_key = key_animator->current->data;
clutter_interval_set_initial_value (key_animator->interval,
&current_key->value);
clutter_interval_set_final_value (key_animator->interval,
&current_key->value);
break;
}
clutter_interval_set_final_value (key_animator->interval,
&next_key->value);
if ((clutter_alpha_get_mode (key_animator->alpha) != next_key->mode))
clutter_alpha_set_mode (key_animator->alpha, next_key->mode);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment