From ba9aa3b332cd8f6bd57983a5dfbb6a24e8fd8ad9 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 6 Sep 2010 18:08:44 +0100 Subject: [PATCH] texture: Move the material unref() in ::dispose --- clutter/clutter-texture.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index 04d5270..6c1cbb3 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -217,10 +217,12 @@ texture_free_gl_resources (ClutterTexture *texture) CLUTTER_MARK(); if (priv->material != COGL_INVALID_HANDLE) - /* We want to keep the layer so that the filter settings will - remain but we want to free its resources so we clear the - texture handle */ - cogl_material_set_layer (priv->material, 0, COGL_INVALID_HANDLE); + { + /* We want to keep the layer so that the filter settings will + remain but we want to free its resources so we clear the + texture handle */ + cogl_material_set_layer (priv->material, 0, COGL_INVALID_HANDLE); + } } static void @@ -734,21 +736,13 @@ static void clutter_texture_dispose (GObject *object) { ClutterTexture *texture = CLUTTER_TEXTURE (object); + ClutterTexturePrivate *priv = texture->priv; texture_free_gl_resources (texture); texture_fbo_free_resources (texture); clutter_texture_async_load_cancel (texture); - G_OBJECT_CLASS (clutter_texture_parent_class)->dispose (object); -} - -static void -clutter_texture_finalize (GObject *object) -{ - ClutterTexture *texture = CLUTTER_TEXTURE (object); - ClutterTexturePrivate *priv = texture->priv; - if (priv->material != COGL_INVALID_HANDLE) { cogl_handle_unref (priv->material); @@ -761,6 +755,14 @@ clutter_texture_finalize (GObject *object) priv->pick_material = COGL_INVALID_HANDLE; } + G_OBJECT_CLASS (clutter_texture_parent_class)->dispose (object); +} + +static void +clutter_texture_finalize (GObject *object) +{ + ClutterTexturePrivate *priv = CLUTTER_TEXTURE (object)->priv; + g_free (priv->filename); G_OBJECT_CLASS (clutter_texture_parent_class)->finalize (object); -- 2.7.4