mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-script.c: (clutter_script_construct_object): Mark top-level objects, that is objects that don't have their ownership transferred when building up a ClutterScript. (object_info_free): Merge a fix from the stable branch, but do not check the type - check whether the object is a top level (we still need the ClutterActor type check in order to call clutter_actor_destroy()).
This commit is contained in:
parent
d27ea0b4ac
commit
cb279f999a
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-script.c:
|
||||||
|
(clutter_script_construct_object): Mark top-level objects,
|
||||||
|
that is objects that don't have their ownership transferred
|
||||||
|
when building up a ClutterScript.
|
||||||
|
|
||||||
|
(object_info_free): Merge a fix from the stable branch, but
|
||||||
|
do not check the type - check whether the object is a top
|
||||||
|
level (we still need the ClutterActor type check in order to
|
||||||
|
call clutter_actor_destroy()).
|
||||||
|
|
||||||
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
|
2008-05-28 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-rectangle.c:
|
* clutter/clutter-rectangle.c:
|
||||||
|
@ -1225,6 +1225,22 @@ add_children (ClutterScript *script,
|
|||||||
oinfo->children = unresolved;
|
oinfo->children = unresolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
const gchar *type_name;
|
||||||
|
guint is_toplevel : 1;
|
||||||
|
} clutter_toplevels[] = {
|
||||||
|
{ "ClutterActor", FALSE },
|
||||||
|
{ "ClutterAlpha", FALSE },
|
||||||
|
{ "ClutterBehaviour", TRUE },
|
||||||
|
{ "ClutterEffectTemplate", TRUE },
|
||||||
|
{ "ClutterModel", TRUE },
|
||||||
|
{ "ClutterScore", TRUE },
|
||||||
|
{ "ClutterTimeline", TRUE }
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint n_clutter_toplevels = G_N_ELEMENTS (clutter_toplevels);
|
||||||
|
|
||||||
GObject *
|
GObject *
|
||||||
clutter_script_construct_object (ClutterScript *script,
|
clutter_script_construct_object (ClutterScript *script,
|
||||||
ObjectInfo *oinfo)
|
ObjectInfo *oinfo)
|
||||||
@ -1353,6 +1369,19 @@ clutter_script_construct_object (ClutterScript *script,
|
|||||||
}
|
}
|
||||||
g_array_free (params, TRUE);
|
g_array_free (params, TRUE);
|
||||||
|
|
||||||
|
for (i = 0; i < n_clutter_toplevels; i++)
|
||||||
|
{
|
||||||
|
const gchar *t_name = clutter_toplevels[i].type_name;
|
||||||
|
GType t_type;
|
||||||
|
|
||||||
|
t_type = clutter_script_get_type_from_name (script, t_name);
|
||||||
|
if (g_type_is_a (oinfo->gtype, t_name))
|
||||||
|
{
|
||||||
|
oinfo->is_toplevel = clutter_toplevels[i].is_toplevel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (oinfo->children && CLUTTER_IS_CONTAINER (object))
|
if (oinfo->children && CLUTTER_IS_CONTAINER (object))
|
||||||
add_children (script, CLUTTER_CONTAINER (object), oinfo);
|
add_children (script, CLUTTER_CONTAINER (object), oinfo);
|
||||||
|
|
||||||
@ -1464,15 +1493,30 @@ object_info_free (gpointer data)
|
|||||||
g_list_foreach (oinfo->behaviours, (GFunc) g_free, NULL);
|
g_list_foreach (oinfo->behaviours, (GFunc) g_free, NULL);
|
||||||
g_list_free (oinfo->behaviours);
|
g_list_free (oinfo->behaviours);
|
||||||
|
|
||||||
if (oinfo->is_toplevel && oinfo->object)
|
/* we unref top-level objects and leave the actors alone,
|
||||||
|
* unless we are unmerging in which case we have to destroy
|
||||||
|
* the actor to unparent them
|
||||||
|
*/
|
||||||
|
if (oinfo->object)
|
||||||
{
|
{
|
||||||
g_object_unref (oinfo->object);
|
if (oinfo->is_unmerged)
|
||||||
oinfo->object = NULL;
|
{
|
||||||
}
|
if (oinfo->is_toplevel)
|
||||||
|
g_object_unref (oinfo->object);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* destroy every actor, unless it's the default stage */
|
||||||
|
if (oinfo->is_stage_default != TRUE &&
|
||||||
|
CLUTTER_IS_ACTOR (oinfo->object))
|
||||||
|
clutter_actor_destroy (CLUTTER_ACTOR (oinfo->object));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oinfo->is_toplevel)
|
||||||
|
g_object_unref (oinfo->object);
|
||||||
|
}
|
||||||
|
|
||||||
if (oinfo->is_unmerged && oinfo->object && !oinfo->is_stage_default)
|
|
||||||
{
|
|
||||||
clutter_actor_destroy (CLUTTER_ACTOR (oinfo->object));
|
|
||||||
oinfo->object = NULL;
|
oinfo->object = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user