From 76b71f8cc4373c1c87d62b9e94921b8e701bef30 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 13 Jun 2008 14:58:18 +0000 Subject: [PATCH] 2008-06-13 Emmanuele Bassi * clutter/clutter-texture.c: (clutter_texture_unrealize), (clutter_texture_dispose): Add a guard against reading back memory during the unrealization on dispose. --- ChangeLog | 7 +++++++ clutter/clutter-texture.c | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index baee625b0..4ece3e6c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-13 Emmanuele Bassi + + * clutter/clutter-texture.c: + (clutter_texture_unrealize), (clutter_texture_dispose): Add a + guard against reading back memory during the unrealization on + dispose. + 2008-06-13 Emmanuele Bassi Bug #953 - Actors are not hidden before unrealized or diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index 63b0a90be..5a9da209d 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -93,6 +93,8 @@ struct _ClutterTexturePrivate guint local_data_rowstride; guint local_data_has_alpha; guchar *local_data; + + guint in_dispose : 1; }; enum @@ -213,7 +215,8 @@ clutter_texture_unrealize (ClutterActor *actor) * a dispose run, and the dispose() call will release the GL * texture data as well, so we can safely bail out now */ - if (CLUTTER_PRIVATE_FLAGS (actor) & CLUTTER_ACTOR_IN_DESTRUCTION) + if ((CLUTTER_PRIVATE_FLAGS (actor) & CLUTTER_ACTOR_IN_DESTRUCTION) || + priv->in_dispose) return; CLUTTER_MARK(); @@ -466,6 +469,14 @@ clutter_texture_dispose (GObject *object) priv = texture->priv; + /* mark that we are in dispose, so when the parent class' + * dispose implementation will call unrealize on us we'll + * not try to copy back the resources from video memory + * to system memory + */ + if (!priv->in_dispose) + priv->in_dispose = TRUE; + texture_free_gl_resources (texture); texture_fbo_free_resources (texture);