script: Fix the memory management

Currently, the memory management in ClutterScript is overly complicated.
The basic design tenet should be:

  - ClutterScript owns a reference on every object it creates

This allows the Script instance to reliably handle the lifetime of the
instances from creation to disposal.

In case of unmerge, the Script instance should destroy any Actor
instance, except for the Stage, and release the reference it owns. The
Stage is special because it's really owned by Clutter itself, and it
should be destroyed explicitly.

When disposing the Script itself, it should just release the reference;
any parented actor, or any InitiallyUnowned instance, will then be
managed by the parent object, as they should, while every GObject
instance will go away, as documented.

This commit is based on a patch by:

  Henrik Hedberg <hhedberg@innologies.fi>

http://bugzilla.clutter-project.org/show_bug.cgi?id=2316
This commit is contained in:
Emmanuele Bassi
2010-09-13 23:29:52 +03:00
parent 20a359cc53
commit 21eb49098a
3 changed files with 29 additions and 24 deletions

View File

@ -66,8 +66,9 @@ typedef struct {
guint merge_id;
guint is_actor : 1;
guint is_stage : 1;
guint is_stage_default : 1;
guint is_toplevel : 1;
guint has_unresolved : 1;
guint is_unmerged : 1;
} ObjectInfo;