Applied patch from bug #871
authorNeil Roberts <neil@openedhand.com>
Wed, 9 Apr 2008 09:33:32 +0000 (09:33 +0000)
committerNeil Roberts <neil@openedhand.com>
Wed, 9 Apr 2008 09:33:32 +0000 (09:33 +0000)
* 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.

ChangeLog
clutter/clutter-stage.c
clutter/x11/clutter-backend-x11.c

index cf97d03..796b7c0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-04-09  Neil Roberts  <neil@o-hand.com>
+
+       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  <ebassi@openedhand.com>
 
        * clutter/clutter-backend.c: Add more debug messages
index cb9e208..3322124 100644 (file)
@@ -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)
index 58c334f..908574b 100644 (file)
@@ -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));