diff --git a/ChangeLog b/ChangeLog index cf97d036c..796b7c080 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-04-09 Neil Roberts + + Applied patch from bug #871 + + * clutter/x11/clutter-backend-x11.c (clutter_backend_x11_dispose): + Call g_slist_foreach instead of iterating over the stage_manager + list manually when deleting stages. Otherwise the 'next' pointer + of the list node can get corrupted when the actor removes itself + from the list. + + * clutter/clutter-stage.c (clutter_stage_dispose): Call + clutter_actor_unrealize in the dispose handler. This fixes + problems where the dispose handler for the ClutterStageWrapper + can't deselect the GL context until the stage is unrealized. + 2008-04-04 Emmanuele Bassi * clutter/clutter-backend.c: Add more debug messages diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index cb9e208bb..3322124ac 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -363,6 +363,8 @@ clutter_stage_dispose (GObject *object) priv->update_idle = 0; } + clutter_actor_unrealize (CLUTTER_ACTOR (object)); + _clutter_stage_manager_remove_stage (stage_manager, stage); if (priv->impl) diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c index 58c334ff3..908574b98 100644 --- a/clutter/x11/clutter-backend-x11.c +++ b/clutter/x11/clutter-backend-x11.c @@ -242,18 +242,17 @@ clutter_backend_x11_dispose (GObject *gobject) ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (gobject); ClutterMainContext *context; ClutterStageManager *stage_manager; - GSList *l; CLUTTER_NOTE (BACKEND, "Disposing the of stages"); context = clutter_context_get_default (); stage_manager = context->stage_manager; - for (l = stage_manager->stages; l; l = l->next) - { - ClutterActor *stage = CLUTTER_ACTOR (l->data); - clutter_actor_destroy (stage); - } + /* Destroy all of the stages. g_slist_foreach is used because the + finalizer for the stages will remove the stage from the + stage_manager's list and g_slist_foreach has some basic + protection against this */ + g_slist_foreach (stage_manager->stages, (GFunc) clutter_actor_destroy, NULL); CLUTTER_NOTE (BACKEND, "Removing the event source"); _clutter_backend_x11_events_uninit (CLUTTER_BACKEND (backend_x11));