diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index d2882acaf..f5e3f3e81 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -3316,7 +3316,7 @@ clutter_actor_dispose (GObject *object) ClutterActorPrivate *priv = self->priv; CLUTTER_NOTE (MISC, "Disposing of object (id=%d) of type '%s' (ref_count:%d)", - self->priv->id, + priv->id, g_type_name (G_OBJECT_TYPE (self)), object->ref_count); @@ -3386,8 +3386,9 @@ clutter_actor_finalize (GObject *object) priv->id, g_type_name (G_OBJECT_TYPE (object))); + _clutter_context_release_id (priv->id); + g_free (priv->name); - clutter_id_pool_remove (CLUTTER_CONTEXT()->id_pool, priv->id); G_OBJECT_CLASS (clutter_actor_parent_class)->finalize (object); } @@ -4887,7 +4888,7 @@ clutter_actor_init (ClutterActor *self) priv->parent_actor = NULL; priv->has_clip = FALSE; priv->opacity = 0xff; - priv->id = clutter_id_pool_add (CLUTTER_CONTEXT()->id_pool, self); + priv->id = _clutter_context_acquire_id (self); priv->scale_x = 1.0; priv->scale_y = 1.0; priv->show_on_set_parent = TRUE; diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 58447d9f2..0d7362619 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -3245,6 +3245,22 @@ _clutter_clear_events_queue (void) } } +guint32 +_clutter_context_acquire_id (gpointer key) +{ + ClutterMainContext *context = _clutter_context_get_default (); + + return clutter_id_pool_add (context->id_pool, key); +} + +void +_clutter_context_release_id (guint32 id_) +{ + ClutterMainContext *context = _clutter_context_get_default (); + + return clutter_id_pool_remove (context->id_pool, id_); +} + void _clutter_clear_events_queue_for_stage (ClutterStage *stage) { diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index 25d9d87a8..04a42748d 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -179,6 +179,8 @@ ClutterPickMode _clutter_context_get_pick_mode (void); void _clutter_context_push_shader_stack (ClutterActor *actor); ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor); ClutterActor * _clutter_context_peek_shader_stack (void); +guint32 _clutter_context_acquire_id (gpointer key); +void _clutter_context_release_id (guint32 id_); #define CLUTTER_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) #define CLUTTER_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)