From 1677e9d2633adc58f2e07c32a61f52b1a785ae85 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Thu, 28 Jun 2007 15:18:20 +0000 Subject: [PATCH] fixed crash in clutter_group_raise / _lower() --- ChangeLog | 7 +++++++ clutter/clutter-group.c | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5143b2b5..96c24a00e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-28 Tomas Frydrych + + * clutter/clutter-group.c: + (clutter_group_raise): + (clutter_group_lower): + Fixed SIGSEGV when attempting to raise / lower an only child. + 2007-06-28 Matthew Allum * clutter/cogl/gl/cogl.c: (cogl_setup_viewport): diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index b48987599..63b0de822 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -596,7 +596,10 @@ clutter_group_raise (ClutterGroup *self, /* Raise top */ last_item = g_list_last (priv->children); - sibling = last_item->data; + + if (last_item) + sibling = last_item->data; + priv->children = g_list_append (priv->children, actor); } else @@ -609,7 +612,8 @@ clutter_group_raise (ClutterGroup *self, * values will be correct. * FIXME: optimise */ - if (clutter_actor_get_depth(sibling) != clutter_actor_get_depth (actor)) + if ( sibling && + clutter_actor_get_depth(sibling) != clutter_actor_get_depth (actor)) clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); @@ -644,7 +648,9 @@ clutter_group_lower (ClutterGroup *self, GList *last_item; /* Raise top */ last_item = g_list_first (priv->children); - sibling = last_item->data; + + if (last_item) + sibling = last_item->data; priv->children = g_list_prepend (priv->children, actor); } @@ -652,7 +658,8 @@ clutter_group_lower (ClutterGroup *self, priv->children = g_list_insert (priv->children, actor, pos); /* See comment in group_raise for this */ - if (clutter_actor_get_depth(sibling) != clutter_actor_get_depth(actor)) + if (sibling && + clutter_actor_get_depth(sibling) != clutter_actor_get_depth(actor)) clutter_actor_set_depth (actor, clutter_actor_get_depth(sibling)); }