texture: Move the material unref() in ::dispose
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 6 Sep 2010 17:08:44 +0000 (18:08 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 6 Sep 2010 17:09:19 +0000 (18:09 +0100)
clutter/clutter-texture.c

index 04d5270..6c1cbb3 100644 (file)
@@ -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);