summaryrefslogtreecommitdiff
path: root/clutter/clutter-state.c
diff options
context:
space:
mode:
authorChris Lord <chris@linux.intel.com>2010-10-22 15:24:49 +0100
committerChris Lord <chris@linux.intel.com>2010-10-25 17:21:20 +0100
commit73dcbedc8067fac25e43d833036f8c76f7c01282 (patch)
treefc2a5a90fe52dc7876f68d9fd34816d3aa21525f /clutter/clutter-state.c
parent5700b34b9cd894e6847dc8973e358104b47fdae5 (diff)
downloadclutter-73dcbedc8067fac25e43d833036f8c76f7c01282.tar.gz
state: Fix crasher when removing the last key of a transitioning state
If ClutterState is in the middle of a transition and you remove all the keys from the target state, the target state will be destroyed without stopping the animation/unsetting the target state. This caused an invalid memory access.
Diffstat (limited to 'clutter/clutter-state.c')
-rw-r--r--clutter/clutter-state.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/clutter/clutter-state.c b/clutter/clutter-state.c
index 493aeb08c..607d42935 100644
--- a/clutter/clutter-state.c
+++ b/clutter/clutter-state.c
@@ -302,6 +302,10 @@ again_for_target_state:
/* no more keys with transitions to this target_state*/
if (target_state->keys == NULL)
{
+ /* If this state is the current state, unset the state */
+ if (target_state == this->priv->target_state)
+ clutter_state_set_state (this, NULL);
+
/* remove any keys that exist that uses this state as a source */
clutter_state_remove_key (this, s->data, NULL, NULL, NULL);